Fix handling of return code for system() calls (#16225)
authorJan Kotas <jkotas@microsoft.com>
Tue, 6 Feb 2018 19:11:47 +0000 (11:11 -0800)
committerGitHub <noreply@github.com>
Tue, 6 Feb 2018 19:11:47 +0000 (11:11 -0800)
The value returned from system() is encoded bag of bits that gets
misinterpretted once it starts propagate through the system. Normalize
it to 0/1.

tests/scripts/run-corefx-tests.py

index ba49631..7f6ff39 100644 (file)
@@ -237,8 +237,8 @@ def main(args):
     command = "git checkout %s" % fx_commit
     log(command)
     returncode = 0 if testing else os.system(command)
-    if not returncode == 0:
-        sys.exit(returncode)
+    if returncode != 0:
+        sys.exit(1)
 
     # On Unix, coreFx build.sh requires HOME to be set, and it isn't by default
     # under our CI system, so set it now.
@@ -266,7 +266,7 @@ def main(args):
     log(command)
     returncode = 0 if testing else os.system(command)
     if returncode != 0:
-        sys.exit(returncode)
+        sys.exit(1)
 
     # Build the build-tests command line.
 
@@ -303,8 +303,10 @@ def main(args):
 
     log(command)
     returncode = 0 if testing else os.system(command)
+    if returncode != 0:
+        sys.exit(1)
 
-    sys.exit(returncode)
+    sys.exit(0)
 
 
 ##########################################################################