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 <rep...@bugs.python.org>
<https://bugs.python.org/issue31447>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to