mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Add a 'timeout' argument to subprocess.Popen.
If the timeout expires before the subprocess exits, the wait method and the communicate method will raise a subprocess.TimeoutExpired exception. When used with communicate, it is possible to catch the exception, kill the process, and retry the communicate and receive any output written to stdout or stderr.
This commit is contained in:
parent
4169826a00
commit
31aa7dd141
4 changed files with 367 additions and 98 deletions
|
@ -682,6 +682,7 @@ PyInit__subprocess()
|
|||
defint(d, "SW_HIDE", SW_HIDE);
|
||||
defint(d, "INFINITE", INFINITE);
|
||||
defint(d, "WAIT_OBJECT_0", WAIT_OBJECT_0);
|
||||
defint(d, "WAIT_TIMEOUT", WAIT_TIMEOUT);
|
||||
defint(d, "CREATE_NEW_CONSOLE", CREATE_NEW_CONSOLE);
|
||||
defint(d, "CREATE_NEW_PROCESS_GROUP", CREATE_NEW_PROCESS_GROUP);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue