Show More
@@ -15,6 +15,7 import sys | |||
|
15 | 15 | from .i18n import _ |
|
16 | 16 | from . import ( |
|
17 | 17 | error, |
|
18 | scmutil, | |
|
18 | 19 | util, |
|
19 | 20 | ) |
|
20 | 21 | |
@@ -132,15 +133,26 def _posixworker(ui, func, staticargs, a | |||
|
132 | 133 | if pid == 0: |
|
133 | 134 | signal.signal(signal.SIGINT, oldhandler) |
|
134 | 135 | signal.signal(signal.SIGCHLD, oldchldhandler) |
|
135 | try: | |
|
136 | ||
|
137 | def workerfunc(): | |
|
136 | 138 | os.close(rfd) |
|
137 | 139 | for i, item in func(*(staticargs + (pargs,))): |
|
138 | 140 | os.write(wfd, '%d %s\n' % (i, item)) |
|
139 | os._exit(0) | |
|
141 | ||
|
142 | # make sure we use os._exit in all code paths. otherwise the worker | |
|
143 | # may do some clean-ups which could cause surprises like deadlock. | |
|
144 | # see sshpeer.cleanup for example. | |
|
145 | try: | |
|
146 | scmutil.callcatch(ui, workerfunc) | |
|
140 | 147 | except KeyboardInterrupt: |
|
141 | 148 | os._exit(255) |
|
142 | # other exceptions are allowed to propagate, we rely | |
|
143 | # on lock.py's pid checks to avoid release callbacks | |
|
149 | except: # never return, therefore no re-raises | |
|
150 | try: | |
|
151 | ui.traceback() | |
|
152 | finally: | |
|
153 | os._exit(255) | |
|
154 | else: | |
|
155 | os._exit(0) | |
|
144 | 156 | pids.add(pid) |
|
145 | 157 | os.close(wfd) |
|
146 | 158 | fp = os.fdopen(rfd, 'rb', 0) |
General Comments 0
You need to be logged in to leave comments.
Login now