From b13cc86c9f9e2f6919b2803ff2d7f141e4d37cad Mon Sep 17 00:00:00 2001 From: Manuel Traut Date: Wed, 22 Nov 2017 13:02:23 +0100 Subject: reprint stdout and stderr if pyjutest is used in e.g. jenkins and a command after the pyjutest call and before archiving the unit file fails, the output of the command is lost. To avoid this, pyjutest now redirects the original output of the command. Signed-off-by: Manuel Traut --- pyjutest | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pyjutest b/pyjutest index 68d916e..c3261d7 100755 --- a/pyjutest +++ b/pyjutest @@ -4,6 +4,8 @@ # # pyjutest - junit xml generator +from __future__ import print_function + from junit_xml import TestSuite, TestCase from pickle import dump, load from subprocess import Popen, PIPE, STDOUT @@ -42,3 +44,10 @@ with open('pyjutest.dat', 'wb') as dat: with open('pyjutest.xml', 'w') as xml: TestSuite.to_file(xml, tss, prettyprint=True) + +print("%s STDOUT:" % sys.argv[1]) +for l in out.decode().split("\n"): + print(l) +print("%s STDERR:" % sys.argv[1]) +for l in err.decode().split("\n"): + print(l, file=sys.stderr) -- cgit v1.2.3