Commits

Eric Gazoni committed 157f30c

[hudson] added output of the error log in case of error

Comments (0)

Files changed (1)

         stderr_filename = osp.join(cwd, "hudson.%s.error.log" % command_name)
 
         print_title("executing %s on %s (in %s)" % (' '.join(args), name, exec_dir))
-        with open(stderr_filename, 'w') as stderr:
+        with open(stderr_filename, 'r+') as stderr:
             
             return_code = subprocess.call(args=args, env=patched_env, 
                     shell=True, cwd=exec_dir, 
             if fail_on == 'return':
                 if return_code:
                     print_title("FAILED: command returned code %s" % return_code, "!")
+                    stderr.seek(0)
+                    print stderr.read()
                     sys.exit(return_code)
             elif fail_on in ('log', 'file', 'logs'):
                 if stderr.tell():
                     print_title("FAILED: error file %s was not empty" % stderr_filename, "!")
+                    stderr.seek(0)
+                    print stderr.read()
                     sys.exit(1)