summaryrefslogtreecommitdiffstats
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-10-10 18:10:44 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-10-10 18:10:44 (GMT)
commitb36a05094d16bfb86c1b113bcab769ca6dbeee7a (patch)
treeb137758b30fa94c2b3f4a5388b69128d159bdaf9 /Lib/subprocess.py
parent00f86f2202ca7dc78604b387ae61e269b90f0079 (diff)
parentdb8570349e3a3d02e3fe4300232c3b1ecd9c8259 (diff)
downloadcpython-b36a05094d16bfb86c1b113bcab769ca6dbeee7a.zip
cpython-b36a05094d16bfb86c1b113bcab769ca6dbeee7a.tar.gz
cpython-b36a05094d16bfb86c1b113bcab769ca6dbeee7a.tar.bz2
merge heads
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r--Lib/subprocess.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 775db50..57cc1a4 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1327,6 +1327,7 @@ class Popen(object):
if executable is None:
executable = args[0]
+ orig_executable = executable
# For transferring possible exec failure from child to parent.
# Data format: "exception name:hex errno:description"
@@ -1409,10 +1410,17 @@ class Popen(object):
err_msg = err_msg.decode(errors="surrogatepass")
if issubclass(child_exception_type, OSError) and hex_errno:
errno_num = int(hex_errno, 16)
+ child_exec_never_called = (err_msg == "noexec")
+ if child_exec_never_called:
+ err_msg = ""
if errno_num != 0:
err_msg = os.strerror(errno_num)
if errno_num == errno.ENOENT:
- err_msg += ': ' + repr(args[0])
+ if child_exec_never_called:
+ # The error must be from chdir(cwd).
+ err_msg += ': ' + repr(cwd)
+ else:
+ err_msg += ': ' + repr(orig_executable)
raise child_exception_type(errno_num, err_msg)
raise child_exception_type(err_msg)