summaryrefslogtreecommitdiffstats
path: root/PC/_subprocess.c
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2011-03-14 16:02:10 (GMT)
committerReid Kleckner <reid@kleckner.net>2011-03-14 16:02:10 (GMT)
commit31aa7dd14196858ed25716723f42702c96ede3bd (patch)
treebc7ce88816b0e5778b1b39f5e5379123455c31c3 /PC/_subprocess.c
parent4169826a00bc786185cfce9371a3ba15157bf928 (diff)
downloadcpython-31aa7dd14196858ed25716723f42702c96ede3bd.zip
cpython-31aa7dd14196858ed25716723f42702c96ede3bd.tar.gz
cpython-31aa7dd14196858ed25716723f42702c96ede3bd.tar.bz2
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/_subprocess.c')
-rw-r--r--PC/_subprocess.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/PC/_subprocess.c b/PC/_subprocess.c
index 2338f30..f11e3e3 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);