summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2007-11-20 01:52:14 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2007-11-20 01:52:14 (GMT)
commit90ebd3e0e9c0b244a4472ce3443984b4541adea7 (patch)
tree5dcba8b03d8285941b623b5acaac71b18a09e506 /Modules/posixmodule.c
parent94140157445c602566af2220f85f7483813ff9dc (diff)
downloadcpython-90ebd3e0e9c0b244a4472ce3443984b4541adea7.zip
cpython-90ebd3e0e9c0b244a4472ce3443984b4541adea7.tar.gz
cpython-90ebd3e0e9c0b244a4472ce3443984b4541adea7.tar.bz2
os.system: on Windows, avoid encoding the command and use the "wide" function: _wsystem
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 9d7fe23..27efcd3 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -2540,12 +2540,22 @@ Execute the command (a string) in a subshell.");
static PyObject *
posix_system(PyObject *self, PyObject *args)
{
- char *command;
long sts;
+#ifdef MS_WINDOWS
+ wchar_t *command;
+ if (!PyArg_ParseTuple(args, "u:system", &command))
+ return NULL;
+#else
+ char *command;
if (!PyArg_ParseTuple(args, "s:system", &command))
return NULL;
+#endif
Py_BEGIN_ALLOW_THREADS
+#ifdef MS_WINDOWS
+ sts = _wsystem(command);
+#else
sts = system(command);
+#endif
Py_END_ALLOW_THREADS
return PyInt_FromLong(sts);
}