From: Amaury Forgeot d'Arc Date: Tue, 20 Nov 2007 01:52:14 +0000 (+0000) Subject: os.system: on Windows, avoid encoding the command and use the "wide" function: _wsystem X-Git-Tag: v3.0a2~145 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=90ebd3e0e9c0b244a4472ce3443984b4541adea7;p=python os.system: on Windows, avoid encoding the command and use the "wide" function: _wsystem --- diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 9d7fe238c5..27efcd38d4 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); }