diff options
author | Gregory P. Smith <greg@krypto.org> | 2012-10-10 10:44:47 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2012-10-10 10:44:47 (GMT) |
commit | a10ddb8a5596f2184f013a751768c16a24372adb (patch) | |
tree | e4c64cbe539ce85268f9270e66d329fc858b0262 /Modules | |
parent | 86b0fb23e5efa3e4bdc351d839fec353d82bb588 (diff) | |
parent | 5591b02a4c96c4b530ee024e6b1581f5ba72945d (diff) | |
download | cpython-a10ddb8a5596f2184f013a751768c16a24372adb.zip cpython-a10ddb8a5596f2184f013a751768c16a24372adb.tar.gz cpython-a10ddb8a5596f2184f013a751768c16a24372adb.tar.bz2 |
Fixes Issue #16114: The subprocess module no longer provides a
misleading error message stating that args[0] did not exist when
either the cwd or executable keyword arguments specified a path that
did not exist.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_posixsubprocess.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c index 8f0fcf2..b7b120b 100644 --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -356,7 +356,7 @@ child_exec(char *const exec_array[], PyObject *preexec_fn, PyObject *preexec_fn_args_tuple) { - int i, saved_errno, unused; + int i, saved_errno, unused, reached_preexec = 0; PyObject *result; const char* err_msg = ""; /* Buffer large enough to hold a hex integer. We can't malloc. */ @@ -440,6 +440,7 @@ child_exec(char *const exec_array[], POSIX_CALL(setsid()); #endif + reached_preexec = 1; if (preexec_fn != Py_None && preexec_fn_args_tuple) { /* This is where the user has asked us to deadlock their program. */ result = PyObject_Call(preexec_fn, preexec_fn_args_tuple, NULL); @@ -489,6 +490,10 @@ error: } unused = write(errpipe_write, cur, hex_errno + sizeof(hex_errno) - cur); unused = write(errpipe_write, ":", 1); + if (!reached_preexec) { + /* Indicate to the parent that the error happened before exec(). */ + unused = write(errpipe_write, "noexec", 6); + } /* We can't call strerror(saved_errno). It is not async signal safe. * The parent process will look the error message up. */ } else { |