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