summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2005-12-18 21:06:46 (GMT)
committerFredrik Lundh <fredrik@pythonware.com>2005-12-18 21:06:46 (GMT)
commite515293567dc31cfc8a4c79548215564272f0a2d (patch)
tree6145a1e9f5bd188f543fdcfd0a63a96cb0da8195
parent118be0c6caf744ef48d622ece7fb3668f8ac62d3 (diff)
downloadcpython-e515293567dc31cfc8a4c79548215564272f0a2d.zip
cpython-e515293567dc31cfc8a4c79548215564272f0a2d.tar.gz
cpython-e515293567dc31cfc8a4c79548215564272f0a2d.tar.bz2
added TerminateProcess support to _subprocess driver
-rw-r--r--PC/_subprocess.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/PC/_subprocess.c b/PC/_subprocess.c
index 10e1e7a..8ed4899 100644
--- a/PC/_subprocess.c
+++ b/PC/_subprocess.c
@@ -425,6 +425,26 @@ sp_CreateProcess(PyObject* self, PyObject* args)
}
static PyObject *
+sp_TerminateProcess(PyObject* self, PyObject* args)
+{
+ BOOL result;
+
+ long process;
+ int exit_code;
+ if (! PyArg_ParseTuple(args, "li:TerminateProcess", &process,
+ &exit_code))
+ return NULL;
+
+ result = TerminateProcess((HANDLE) process, exit_code);
+
+ if (! result)
+ return PyErr_SetFromWindowsErr(GetLastError());
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject *
sp_GetExitCodeProcess(PyObject* self, PyObject* args)
{
DWORD exit_code;
@@ -498,6 +518,7 @@ static PyMethodDef sp_functions[] = {
{"DuplicateHandle", sp_DuplicateHandle, METH_VARARGS},
{"CreatePipe", sp_CreatePipe, METH_VARARGS},
{"CreateProcess", sp_CreateProcess, METH_VARARGS},
+ {"TerminateProcess", sp_TerminateProcess, METH_VARARGS},
{"GetExitCodeProcess", sp_GetExitCodeProcess, METH_VARARGS},
{"WaitForSingleObject", sp_WaitForSingleObject, METH_VARARGS},
{"GetVersion", sp_GetVersion, METH_VARARGS},