Show More
@@ -59,6 +59,15 b' import killdaemons as killmod' | |||
|
59 | 59 | import Queue as queue |
|
60 | 60 | |
|
61 | 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 | 72 | closefds = os.name == 'posix' |
|
64 | 73 | def Popen4(cmd, wd, timeout, env=None): |
@@ -67,6 +76,8 b' def Popen4(cmd, wd, timeout, env=None):' | |||
|
67 | 76 | close_fds=closefds, |
|
68 | 77 | stdin=subprocess.PIPE, stdout=subprocess.PIPE, |
|
69 | 78 | stderr=subprocess.STDOUT) |
|
79 | p.wait = waitlocked(p.wait) | |
|
80 | p.poll = waitlocked(p.poll) | |
|
70 | 81 | processlock.release() |
|
71 | 82 | |
|
72 | 83 | p.fromchild = p.stdout |
@@ -838,11 +849,7 b' def run(cmd, wd, options, replacements, ' | |||
|
838 | 849 | cleanup() |
|
839 | 850 | raise |
|
840 | 851 | |
|
841 | try: | |
|
842 | ret = proc.wait() | |
|
843 | except OSError: | |
|
844 | # Py2.4 seems to have a race here | |
|
845 | pass | |
|
852 | ret = proc.wait() | |
|
846 | 853 | if wifexited(ret): |
|
847 | 854 | ret = os.WEXITSTATUS(ret) |
|
848 | 855 |
General Comments 0
You need to be logged in to leave comments.
Login now