Bug 935050 - Manually flush native command's stdout and stderr, multiprocessing exits via os._exit. r=gps
authorZiga Seilnacht <ziga.seilnacht@gmail.com>
Fri, 08 Nov 2013 09:02:08 -0500
changeset 360 42627616700c5dc32375cbb4db2d9644b8661325
parent 359 f99dd2f10896579885fb7fcef67d56d148f6a0a9
child 361 8fa921cbf2ffdfd556eb3de6318d8955f38dfd59
push id228
push userryanvm@gmail.com
push dateFri, 08 Nov 2013 14:02:32 +0000
reviewersgps
bugs935050
Bug 935050 - Manually flush native command's stdout and stderr, multiprocessing exits via os._exit. r=gps
pymake/process.py
--- a/pymake/process.py
+++ b/pymake/process.py
@@ -410,16 +410,20 @@ class PythonJob(Job):
                 pass # sys.exit(0) is not a failure
             else:
                 print >>sys.stderr, e
                 traceback.print_exc()
                 return -127
         finally:
             os.environ.clear()
             os.environ.update(oldenv)
+            # multiprocessing exits via os._exit, make sure that all output
+            # from command gets written out before that happens.
+            sys.stdout.flush()
+            sys.stderr.flush()
         return 0
 
 def job_runner(job):
     """
     Run a job. Called in a Process pool.
     """
     return job.run()