[New-bugs-announce] [issue31447] proc communicate not exiting on python subprocess timeout using PIPES
Leonardo Francalanci
report at bugs.python.org
Wed Sep 13 06:11:27 EDT 2017
New submission from Leonardo Francalanci:
the script below (a python process is called, which calls a waitfor cmd with a timeout of 4 seconds) is supposed to end after 4 seconds. But instead proc.communicate stops after the 20 seconds timeout.
Everything works 100% ok if I remove the stdin/stderr/stdout parameters...
if __name__ == "__main__":
#start a python process which will wait for 4 seconds and then exit (waitfor is set to 200):
proc_str = ["C:\\Program Files (x86)\\Anaconda3\\Python.exe",
"-c", "import
subprocess;subprocess.run('cmd /S /C waitfor g /t 200', shell=False, timeout=4)"]
proc = subprocess.Popen(proc_str,
stdin=subprocess.PIPE,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
shell=False,
universal_newlines=True)
#this should exit in 4 seconds (when the called process exits), but instead exits after 20 seconds:
(proc_out, proc_err) = proc.communicate(timeout=20)
----------
messages: 302051
nosy: Leonardo Francalanci
priority: normal
severity: normal
status: open
title: proc communicate not exiting on python subprocess timeout using PIPES
versions: Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31447>
_______________________________________
More information about the New-bugs-announce
mailing list