Show More
@@ -21,7 +21,7 b' import ctypes' | |||||
21 |
|
21 | |||
22 | from ctypes import c_int, POINTER |
|
22 | from ctypes import c_int, POINTER | |
23 | from ctypes.wintypes import LPCWSTR, HLOCAL |
|
23 | from ctypes.wintypes import LPCWSTR, HLOCAL | |
24 | from subprocess import STDOUT |
|
24 | from subprocess import STDOUT, TimeoutExpired | |
25 |
|
25 | |||
26 | # our own imports |
|
26 | # our own imports | |
27 | from ._process_common import read_no_interrupt, process_handler, arg_split as py_arg_split |
|
27 | from ._process_common import read_no_interrupt, process_handler, arg_split as py_arg_split | |
@@ -100,8 +100,14 b' def _system_body(p):' | |||||
100 | line = line.decode(enc, 'replace') |
|
100 | line = line.decode(enc, 'replace') | |
101 | print(line, file=sys.stderr) |
|
101 | print(line, file=sys.stderr) | |
102 |
|
102 | |||
103 | # Wait to finish for returncode |
|
103 | # Wait to finish for returncode. Unfortunately, Python has a bug where | |
104 | return p.wait() |
|
104 | # wait() isn't interruptible (https://bugs.python.org/issue28168) so poll in | |
|
105 | # a loop instead of just doing `return p.wait()`. | |||
|
106 | while True: | |||
|
107 | try: | |||
|
108 | return p.wait(0.01) | |||
|
109 | except TimeoutExpired: | |||
|
110 | pass | |||
105 |
|
111 | |||
106 |
|
112 | |||
107 | def system(cmd): |
|
113 | def system(cmd): |
General Comments 0
You need to be logged in to leave comments.
Login now