We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2d343dd commit 0109821Copy full SHA for 0109821
artiq/tools.py
@@ -91,13 +91,14 @@ def asyncio_process_wait_timeout(process, timeout):
91
# causes a futures.InvalidStateError inside asyncio if and when the
92
# process terminates after the timeout.
93
# Work around this problem.
94
- end_time = time.monotonic() + timeout
95
- r = True
96
- while r:
97
- r = yield from asyncio.wait_for(
98
- process.stdout.read(1024),
99
- timeout=end_time - time.monotonic())
100
-
+ @asyncio.coroutine
+ def process_wait_returncode_timeout():
+ while True:
+ if process.returncode is not None:
+ break
+ yield from asyncio.sleep(0.1)
+ yield from asyncio.wait_for(process_wait_returncode_timeout(),
101
+ timeout=timeout)
102
103
@asyncio.coroutine
104
def asyncio_process_wait(process):
0 commit comments