From b68a25835fe68d7a8cab44ad47aabd5e005f7236 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sat, 30 Apr 2016 17:47:29 +0900 Subject: [PATCH] Make sure output is written when test fails --- script/test.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/script/test.py b/script/test.py index 2acf1f7..85061db 100755 --- a/script/test.py +++ b/script/test.py @@ -30,13 +30,19 @@ def main(): else: atom_shell = os.path.join(SOURCE_ROOT, 'out', config, PROJECT_NAME) - subprocess.check_call([atom_shell, 'spec'] + sys.argv[1:]) + returncode = 0 + try: + subprocess.check_call([atom_shell, 'spec'] + sys.argv[1:]) + except subprocess.CalledProcessError as e: + returncode = e.returncode if os.environ.has_key('OUTPUT_TO_FILE'): output_to_file = os.environ['OUTPUT_TO_FILE'] with open(output_to_file, 'r') as f: print f.read() + return returncode + if __name__ == '__main__': sys.exit(main()) -- 2.7.4