Message287230
This only happens when:
- timeout is small enough
- at least one stream is redirected to a PIPE
When I know for certain that a subprocess has already terminated and I call communicate to retrieve its results with a timeout of 0 (or other small enough value), communicate will always return TimeoutExpired.
The cause is that the check on timeout is done before the ready file descriptors are checked: https://hg.python.org/cpython/file/tip/Lib/subprocess.py#l1484. With a small enough timeout, communicate will never check the file descriptors for EOF.
From a user perspective I would expect to be able to use communicate(timeout=0) to get the output for a process that I know has already terminated or to poll without blocking.
Is this the intended behaviour of communicate or is it a bug? To me this behaviour is surprising. |
|
Date |
User |
Action |
Args |
2017-02-07 11:57:14 | Griffon26 | set | recipients:
+ Griffon26 |
2017-02-07 11:57:14 | Griffon26 | set | messageid: <1486468634.65.0.790221754194.issue29472@psf.upfronthosting.co.za> |
2017-02-07 11:57:14 | Griffon26 | link | issue29472 messages |
2017-02-07 11:57:14 | Griffon26 | create | |
|