diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-05-18 17:17:23 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-05-18 17:17:23 (GMT) |
commit | b745a74c99b9db0daab7289c6a1f0e386cd26644 (patch) | |
tree | 3dd5e45a9311372a36ad280e3c1739ab573cdf9e /Lib/subprocess.py | |
parent | 04b5684d002de5e3eb4232bb287c6884afb61bf3 (diff) | |
download | cpython-b745a74c99b9db0daab7289c6a1f0e386cd26644.zip cpython-b745a74c99b9db0daab7289c6a1f0e386cd26644.tar.gz cpython-b745a74c99b9db0daab7289c6a1f0e386cd26644.tar.bz2 |
Issue #8513: os.get_exec_path() supports b'PATH' key and bytes value.
subprocess.Popen() and os._execvpe() support bytes program name. Add
os.supports_bytes_environ flag: True if the native OS type of the environment
is bytes (eg. False on Windows).
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r-- | Lib/subprocess.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 14f1f67..adbee0b 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1096,15 +1096,14 @@ class Popen(object): for k, v in env.items()] else: env_list = None # Use execv instead of execve. + executable = os.fsencode(executable) if os.path.dirname(executable): - executable_list = (os.fsencode(executable),) + executable_list = (executable,) else: # This matches the behavior of os._execvpe(). - path_list = os.get_exec_path(env) - executable_list = (os.path.join(dir, executable) - for dir in path_list) - executable_list = tuple(os.fsencode(exe) - for exe in executable_list) + executable_list = tuple( + os.path.join(os.fsencode(dir), executable) + for dir in os.get_exec_path(env)) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, cwd, env_list, |