Show More
@@ -92,11 +92,16 def _posixworker(ui, func, staticargs, a | |||
|
92 | 92 | def cleanup(): |
|
93 | 93 | # python 2.4 is too dumb for try/yield/finally |
|
94 | 94 | signal.signal(signal.SIGINT, oldhandler) |
|
95 |
problem |
|
|
95 | problem = None | |
|
96 | 96 | for i in xrange(workers): |
|
97 |
p |
|
|
98 | if problems: | |
|
99 | sys.exit(1) | |
|
97 | pid, st = os.wait() | |
|
98 | st = _exitstatus(st) | |
|
99 | if st and not problem: | |
|
100 | problem = st | |
|
101 | if problem: | |
|
102 | if problem < 0: | |
|
103 | os.kill(os.getpid(), -problem) | |
|
104 | sys.exit(problem) | |
|
100 | 105 | try: |
|
101 | 106 | for line in fp: |
|
102 | 107 | l = line.split(' ', 1) |
@@ -106,8 +111,19 def _posixworker(ui, func, staticargs, a | |||
|
106 | 111 | raise |
|
107 | 112 | cleanup() |
|
108 | 113 | |
|
114 | def _posixexitstatus(code): | |
|
115 | '''convert a posix exit status into the same form returned by | |
|
116 | os.spawnv | |
|
117 | ||
|
118 | returns None if the process was stopped instead of exiting''' | |
|
119 | if os.WIFEXITED(code): | |
|
120 | return os.WEXITSTATUS(code) | |
|
121 | elif os.WIFSIGNALED(code): | |
|
122 | return -os.WTERMSIG(code) | |
|
123 | ||
|
109 | 124 | if os.name != 'nt': |
|
110 | 125 | _platformworker = _posixworker |
|
126 | _exitstatus = _posixexitstatus | |
|
111 | 127 | |
|
112 | 128 | def partition(lst, nslices): |
|
113 | 129 | '''partition a list into N slices of equal size''' |
General Comments 0
You need to be logged in to leave comments.
Login now