##// END OF EJS Templates
A different approach, avoiding wait() altogether.
Itamar Turner-Trauring -
Show More
@@ -18,6 +18,7 b' This file is only meant to be imported by process.py, not by end-users.'
18 import os
18 import os
19 import sys
19 import sys
20 import ctypes
20 import ctypes
21 import time
21
22
22 from ctypes import c_int, POINTER
23 from ctypes import c_int, POINTER
23 from ctypes.wintypes import LPCWSTR, HLOCAL
24 from ctypes.wintypes import LPCWSTR, HLOCAL
@@ -104,10 +105,11 b' def _system_body(p):'
104 # wait() isn't interruptible (https://bugs.python.org/issue28168) so poll in
105 # wait() isn't interruptible (https://bugs.python.org/issue28168) so poll in
105 # a loop instead of just doing `return p.wait()`.
106 # a loop instead of just doing `return p.wait()`.
106 while True:
107 while True:
107 try:
108 result = p.poll()
108 return p.wait(0.01)
109 if result is None:
109 except TimeoutExpired:
110 time.sleep(0.01)
110 pass
111 else:
112 return result
111
113
112
114
113 def system(cmd):
115 def system(cmd):
General Comments 0
You need to be logged in to leave comments. Login now