Mercurial > hg
comparison mercurial/worker.py @ 31696:9d3d56aa1a9f
worker: flush ui buffers before running the worker
a91c6275 introduces flushing ui buffers after a worker finished. If the ui was
not flushed before the worker was started, fork will copy the existing buffers
to the worker. This causes messages issued before the worker started to be
written to the terminal for each worker.
We are now flushing the ui before we start a worker and add an appropriate test
which will fail before this patch.
author | David Soria Parra <davidsp@fb.com> |
---|---|
date | Tue, 28 Mar 2017 10:21:38 -0700 |
parents | 13bbcd56c57a |
children | 8f8ad0139b8b |
comparison
equal
deleted
inserted
replaced
31695:d73490957d61 | 31696:9d3d56aa1a9f |
---|---|
131 def sigchldhandler(signum, frame): | 131 def sigchldhandler(signum, frame): |
132 waitforworkers(blocking=False) | 132 waitforworkers(blocking=False) |
133 if problem[0]: | 133 if problem[0]: |
134 killworkers() | 134 killworkers() |
135 oldchldhandler = signal.signal(signal.SIGCHLD, sigchldhandler) | 135 oldchldhandler = signal.signal(signal.SIGCHLD, sigchldhandler) |
136 ui.flush() | |
136 for pargs in partition(args, workers): | 137 for pargs in partition(args, workers): |
137 pid = os.fork() | 138 pid = os.fork() |
138 if pid == 0: | 139 if pid == 0: |
139 signal.signal(signal.SIGINT, oldhandler) | 140 signal.signal(signal.SIGINT, oldhandler) |
140 signal.signal(signal.SIGCHLD, oldchldhandler) | 141 signal.signal(signal.SIGCHLD, oldchldhandler) |