##// END OF EJS Templates
run-tests: fallback to SIGTERM if subprocess.Popen does not have terminate()
Thomas Arendsen Hein -
r14821:2017495b stable
parent child Browse files
Show More
@@ -78,10 +78,7 b' def Popen4(cmd, wd, timeout):'
78 78 time.sleep(1)
79 79 p.timeout = True
80 80 if p.returncode is None:
81 try:
82 p.terminate()
83 except OSError:
84 pass
81 terminate(p)
85 82 threading.Thread(target=t).start()
86 83
87 84 return p
@@ -343,6 +340,17 b' def checktools():'
343 340 else:
344 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 354 def killdaemons():
347 355 # Kill off any leftover daemon processes
348 356 try:
@@ -651,10 +659,7 b' def run(cmd, wd, options, replacements):'
651 659
652 660 proc = Popen4(cmd, wd, options.timeout)
653 661 def cleanup():
654 try:
655 proc.terminate()
656 except OSError:
657 pass
662 terminate(proc)
658 663 ret = proc.wait()
659 664 if ret == 0:
660 665 ret = signal.SIGTERM << 8
General Comments 0
You need to be logged in to leave comments. Login now