equal
deleted
inserted
replaced
9 |
9 |
10 import errno |
10 import errno |
11 import os |
11 import os |
12 import signal |
12 import signal |
13 import sys |
13 import sys |
14 import threading |
|
15 |
14 |
16 from .i18n import _ |
15 from .i18n import _ |
17 from . import ( |
16 from . import ( |
18 error, |
17 error, |
19 util, |
18 util, |
136 # other exceptions are allowed to propagate, we rely |
135 # other exceptions are allowed to propagate, we rely |
137 # on lock.py's pid checks to avoid release callbacks |
136 # on lock.py's pid checks to avoid release callbacks |
138 pids.add(pid) |
137 pids.add(pid) |
139 os.close(wfd) |
138 os.close(wfd) |
140 fp = os.fdopen(rfd, 'rb', 0) |
139 fp = os.fdopen(rfd, 'rb', 0) |
141 t = threading.Thread(target=waitforworkers) |
|
142 t.start() |
|
143 def cleanup(): |
140 def cleanup(): |
144 signal.signal(signal.SIGINT, oldhandler) |
141 signal.signal(signal.SIGINT, oldhandler) |
145 t.join() |
142 waitforworkers() |
146 signal.signal(signal.SIGCHLD, oldchldhandler) |
143 signal.signal(signal.SIGCHLD, oldchldhandler) |
147 status = problem[0] |
144 status = problem[0] |
148 if status: |
145 if status: |
149 if status < 0: |
146 if status < 0: |
150 os.kill(os.getpid(), -status) |
147 os.kill(os.getpid(), -status) |