Author Leonardo Francalanci
Recipients Leonardo Francalanci
Date 2017-09-13.10:11:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1505297487.8.0.0553413859223.issue31447@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2017-09-13 10:11:27Leonardo Francalancisetrecipients: + Leonardo Francalanci
2017-09-13 10:11:27Leonardo Francalancisetmessageid: <1505297487.8.0.0553413859223.issue31447@psf.upfronthosting.co.za>
2017-09-13 10:11:27Leonardo Francalancilinkissue31447 messages
2017-09-13 10:11:27Leonardo Francalancicreate