worker: flush messages written by child processes before exit stable
authorYuya Nishihara <yuya@tcha.org>
Sat, 25 Feb 2017 12:48:50 +0900
branchstable
changeset 31118 a91c62752d08
parent 31117 92bca12328d1
child 31119 13bbcd56c57a
child 31137 25703b624d27
worker: flush messages written by child processes before exit I found some child outputs were lost while testing the previous patch. Since os._exit() does nothing special, we need to do that explicitly.
mercurial/worker.py
tests/test-simple-update.t
--- a/mercurial/worker.py	Sat Feb 25 12:33:37 2017 +0900
+++ b/mercurial/worker.py	Sat Feb 25 12:48:50 2017 +0900
@@ -148,12 +148,16 @@
             # may do some clean-ups which could cause surprises like deadlock.
             # see sshpeer.cleanup for example.
             try:
-                scmutil.callcatch(ui, workerfunc)
+                try:
+                    scmutil.callcatch(ui, workerfunc)
+                finally:
+                    ui.flush()
             except KeyboardInterrupt:
                 os._exit(255)
             except: # never return, therefore no re-raises
                 try:
                     ui.traceback()
+                    ui.flush()
                 finally:
                     os._exit(255)
             else:
--- a/tests/test-simple-update.t	Sat Feb 25 12:33:37 2017 +0900
+++ b/tests/test-simple-update.t	Sat Feb 25 12:48:50 2017 +0900
@@ -84,7 +84,8 @@
 
   $ hg update null
   0 files updated, 0 files merged, 100 files removed, 0 files unresolved
-  $ hg update
+  $ hg update -v | grep 100
+  getting 100
   100 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ cd ..