add filename to ENOENT message #4925
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index d699ed0..b40d2a8 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1255,6 +1255,8 @@
errno = int(hex_errno, 16)
if errno != 0:
err_msg = os.strerror(errno)
+ if errno == errno.ENOENT:
+ err_msg += ': ' + repr(args[0])
raise child_exception_type(errno, err_msg)
raise child_exception_type(err_msg)
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 1a9fb69..f8ecb4d 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -666,6 +666,7 @@
# string and instead capture the exception that we want to see
# below for comparison.
desired_exception = e
+ desired_exception.strerror += ': ' + repr(sys.executable)
else:
self.fail("chdir to nonexistant directory %s succeeded." %
nonexistent_dir)