##// END OF EJS Templates
run-tests: lock popen wait/poll...
Brendan Cully -
r19413:a4de0d3d default
parent child Browse files
Show More
@@ -59,6 +59,15 b' import killdaemons as killmod'
59 import Queue as queue
59 import Queue as queue
60
60
61 processlock = threading.Lock()
61 processlock = threading.Lock()
62 waitlock = threading.Lock()
63
64 def waitlocked(fn):
65 def run():
66 waitlock.acquire()
67 ret = fn()
68 waitlock.release()
69 return ret
70 return run
62
71
63 closefds = os.name == 'posix'
72 closefds = os.name == 'posix'
64 def Popen4(cmd, wd, timeout, env=None):
73 def Popen4(cmd, wd, timeout, env=None):
@@ -67,6 +76,8 b' def Popen4(cmd, wd, timeout, env=None):'
67 close_fds=closefds,
76 close_fds=closefds,
68 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
77 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
69 stderr=subprocess.STDOUT)
78 stderr=subprocess.STDOUT)
79 p.wait = waitlocked(p.wait)
80 p.poll = waitlocked(p.poll)
70 processlock.release()
81 processlock.release()
71
82
72 p.fromchild = p.stdout
83 p.fromchild = p.stdout
@@ -838,11 +849,7 b' def run(cmd, wd, options, replacements, '
838 cleanup()
849 cleanup()
839 raise
850 raise
840
851
841 try:
852 ret = proc.wait()
842 ret = proc.wait()
843 except OSError:
844 # Py2.4 seems to have a race here
845 pass
846 if wifexited(ret):
853 if wifexited(ret):
847 ret = os.WEXITSTATUS(ret)
854 ret = os.WEXITSTATUS(ret)
848
855
General Comments 0
You need to be logged in to leave comments. Login now