summaryrefslogtreecommitdiff
path: root/PC
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2011-03-14 12:02:10 -0400
committerReid Kleckner <reid@kleckner.net>2011-03-14 12:02:10 -0400
commit31aa7dd14196858ed25716723f42702c96ede3bd (patch)
treebc7ce88816b0e5778b1b39f5e5379123455c31c3 /PC
parent4169826a00bc786185cfce9371a3ba15157bf928 (diff)
downloadcpython-git-31aa7dd14196858ed25716723f42702c96ede3bd.tar.gz
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.
Diffstat (limited to 'PC')
-rw-r--r--PC/_subprocess.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/PC/_subprocess.c b/PC/_subprocess.c
index 2338f3085b..f11e3e3a16 100644
--- a/PC/_subprocess.c
+++ b/PC/_subprocess.c
@@ -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);