]> granicus.if.org Git - python/commitdiff
When an external application we use exits normally, exit with the same
authorFred Drake <fdrake@acm.org>
Wed, 14 May 2003 04:16:14 +0000 (04:16 +0000)
committerFred Drake <fdrake@acm.org>
Wed, 14 May 2003 04:16:14 +0000 (04:16 +0000)
exit code they returned.  All other types of exit from child processes
are normalized to a return code of 1.
Closes SF bug #732143.

Doc/tools/mkhowto

index 7163974a2b2c30429ea66f8a058aa8b020c2ff9c..eed1a58754e04b724ff5a588590c5633dcbf925d 100755 (executable)
@@ -525,9 +525,11 @@ class Job:
             self.warning(
                 "Session transcript and error messages are in %s."
                 % self.log_filename)
+            result = 1
             if hasattr(os, "WIFEXITED"):
                 if os.WIFEXITED(rc):
-                    self.warning("Exited with status %s." % os.WEXITSTATUS(rc))
+                    result = os.WEXITSTATUS(rc)
+                    self.warning("Exited with status %s." % result)
                 else:
                     self.warning("Killed by signal %s." % os.WSTOPSIG(rc))
             else:
@@ -535,7 +537,7 @@ class Job:
             sys.stderr.write("The relevant lines from the transcript are:\n")
             sys.stderr.write("-" * 72 + "\n")
             sys.stderr.writelines(get_run_transcript(self.log_filename))
-            sys.exit(rc)
+            sys.exit(result)
 
     def message(self, msg):
         msg = "+++ " + msg