From 013916866d57a58bd6b1782a24a38fa0f7ea8722 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 13 Jun 2012 15:49:42 +0200 Subject: bldinstallercommon.py: Print output for all failing commands. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Strip leading lines of verly long logs. Change-Id: I0cbb1839906698c49f7e0ef858ad7ded37546b8e Reviewed-by: Simo Fält --- release-tools/bldinstallercommon.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/release-tools/bldinstallercommon.py b/release-tools/bldinstallercommon.py index f63b266..95eceb9 100644 --- a/release-tools/bldinstallercommon.py +++ b/release-tools/bldinstallercommon.py @@ -55,6 +55,8 @@ IS_SOLARIS_PLATFORM = False IS_MAC_PLATFORM = False IS_WIN_PLATFORM = False DEBUG_RPATH = False +MAX_DEBUG_PRINT_LENGTH = 10000 + ############################### # function @@ -520,8 +522,10 @@ def do_execute_sub_process(args, execution_path, abort_on_fail): theproc = subprocess.Popen(args, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=False) else: theproc = subprocess.Popen(args) - theproc.communicate() + output = theproc.communicate()[0] if theproc.returncode: + output = output[len(output) - MAX_DEBUG_PRINT_LENGTH:] if len(output) > MAX_DEBUG_PRINT_LENGTH else output + print output print '*** Execution failed with code: %s' % str(theproc.returncode) if abort_on_fail: sys.exit(-1) @@ -547,8 +551,10 @@ def do_execute_sub_process_2(args, execution_path, abort_on_fail): try: os.chdir(execution_path) theproc = subprocess.Popen(args, shell=True) - theproc.communicate() + output = theproc.communicate()[0] if theproc.returncode: + output = output[len(output) - MAX_DEBUG_PRINT_LENGTH:] if len(output) > MAX_DEBUG_PRINT_LENGTH else output + print output print '*** Execution failed with code: %s' % str(theproc.returncode) if abort_on_fail: sys.exit(-1) @@ -580,9 +586,9 @@ def do_execute_sub_process_get_std_out(args, execution_path, abort_on_fail, prin theproc = subprocess.Popen(args, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=False) else: theproc = subprocess.Popen(args, shell=False, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) - output = theproc.stdout.read() - theproc.communicate() + output = theproc.communicate()[0] if theproc.returncode: + output = output[len(output) - MAX_DEBUG_PRINT_LENGTH:] if len(output) > MAX_DEBUG_PRINT_LENGTH else output print output print '*** Execution failed with code: %s' % str(theproc.returncode) if abort_on_fail: -- cgit v1.2.3