Show More
@@ -89,6 +89,20 b' def _posixworker(ui, func, staticargs, a' | |||
|
89 | 89 | oldhandler = signal.getsignal(signal.SIGINT) |
|
90 | 90 | signal.signal(signal.SIGINT, signal.SIG_IGN) |
|
91 | 91 | pids, problem = [], [0] |
|
92 | def killworkers(): | |
|
93 | # if one worker bails, there's no good reason to wait for the rest | |
|
94 | for p in pids: | |
|
95 | try: | |
|
96 | os.kill(p, signal.SIGTERM) | |
|
97 | except OSError as err: | |
|
98 | if err.errno != errno.ESRCH: | |
|
99 | raise | |
|
100 | def waitforworkers(): | |
|
101 | for _pid in pids: | |
|
102 | st = _exitstatus(os.wait()[1]) | |
|
103 | if st and not problem[0]: | |
|
104 | problem[0] = st | |
|
105 | killworkers() | |
|
92 | 106 | for pargs in partition(args, workers): |
|
93 | 107 | pid = os.fork() |
|
94 | 108 | if pid == 0: |
@@ -106,20 +120,6 b' def _posixworker(ui, func, staticargs, a' | |||
|
106 | 120 | pids.reverse() |
|
107 | 121 | os.close(wfd) |
|
108 | 122 | fp = os.fdopen(rfd, 'rb', 0) |
|
109 | def killworkers(): | |
|
110 | # if one worker bails, there's no good reason to wait for the rest | |
|
111 | for p in pids: | |
|
112 | try: | |
|
113 | os.kill(p, signal.SIGTERM) | |
|
114 | except OSError as err: | |
|
115 | if err.errno != errno.ESRCH: | |
|
116 | raise | |
|
117 | def waitforworkers(): | |
|
118 | for _pid in pids: | |
|
119 | st = _exitstatus(os.wait()[1]) | |
|
120 | if st and not problem[0]: | |
|
121 | problem[0] = st | |
|
122 | killworkers() | |
|
123 | 123 | t = threading.Thread(target=waitforworkers) |
|
124 | 124 | t.start() |
|
125 | 125 | def cleanup(): |
General Comments 0
You need to be logged in to leave comments.
Login now