Show More
@@ -78,10 +78,7 b' def Popen4(cmd, wd, timeout):' | |||||
78 | time.sleep(1) |
|
78 | time.sleep(1) | |
79 | p.timeout = True |
|
79 | p.timeout = True | |
80 | if p.returncode is None: |
|
80 | if p.returncode is None: | |
81 |
t |
|
81 | terminate(p) | |
82 | p.terminate() |
|
|||
83 | except OSError: |
|
|||
84 | pass |
|
|||
85 | threading.Thread(target=t).start() |
|
82 | threading.Thread(target=t).start() | |
86 |
|
83 | |||
87 | return p |
|
84 | return p | |
@@ -343,6 +340,17 b' def checktools():' | |||||
343 | else: |
|
340 | else: | |
344 | print "WARNING: Did not find prerequisite tool: "+p |
|
341 | print "WARNING: Did not find prerequisite tool: "+p | |
345 |
|
342 | |||
|
343 | def terminate(proc): | |||
|
344 | """Terminate subprocess (with fallback for Python versions < 2.6)""" | |||
|
345 | vlog('# Terminating process %d' % proc.pid) | |||
|
346 | try: | |||
|
347 | if hasattr(proc, 'terminate'): | |||
|
348 | proc.terminate() | |||
|
349 | else: | |||
|
350 | os.kill(proc.pid, signal.SIGTERM) | |||
|
351 | except OSError: | |||
|
352 | pass | |||
|
353 | ||||
346 | def killdaemons(): |
|
354 | def killdaemons(): | |
347 | # Kill off any leftover daemon processes |
|
355 | # Kill off any leftover daemon processes | |
348 | try: |
|
356 | try: | |
@@ -651,10 +659,7 b' def run(cmd, wd, options, replacements):' | |||||
651 |
|
659 | |||
652 | proc = Popen4(cmd, wd, options.timeout) |
|
660 | proc = Popen4(cmd, wd, options.timeout) | |
653 | def cleanup(): |
|
661 | def cleanup(): | |
654 | try: |
|
662 | terminate(proc) | |
655 | proc.terminate() |
|
|||
656 | except OSError: |
|
|||
657 | pass |
|
|||
658 | ret = proc.wait() |
|
663 | ret = proc.wait() | |
659 | if ret == 0: |
|
664 | if ret == 0: | |
660 | ret = signal.SIGTERM << 8 |
|
665 | ret = signal.SIGTERM << 8 |
General Comments 0
You need to be logged in to leave comments.
Login now