summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/popen_spawn_win32.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2022-10-20 13:53:38 (GMT)
committerGitHub <noreply@github.com>2022-10-20 13:53:38 (GMT)
commite48f9b2b7e73f4a89a9b9c287f3b93dc13a60460 (patch)
tree31dfc7cb8b10e661fb2b7ca1a608fce98f130884 /Lib/multiprocessing/popen_spawn_win32.py
parentcb93b4aee5eb12dc6c4b2dccc81a2e5ace3ea4de (diff)
downloadcpython-e48f9b2b7e73f4a89a9b9c287f3b93dc13a60460.zip
cpython-e48f9b2b7e73f4a89a9b9c287f3b93dc13a60460.tar.gz
cpython-e48f9b2b7e73f4a89a9b9c287f3b93dc13a60460.tar.bz2
gh-98360: multiprocessing now spawns children on Windows with correct argv[0] in virtual environments (GH-98462)
Diffstat (limited to 'Lib/multiprocessing/popen_spawn_win32.py')
-rw-r--r--Lib/multiprocessing/popen_spawn_win32.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/multiprocessing/popen_spawn_win32.py b/Lib/multiprocessing/popen_spawn_win32.py
index 9c4098d..4d60ffc 100644
--- a/Lib/multiprocessing/popen_spawn_win32.py
+++ b/Lib/multiprocessing/popen_spawn_win32.py
@@ -54,19 +54,20 @@ class Popen(object):
wfd = msvcrt.open_osfhandle(whandle, 0)
cmd = spawn.get_command_line(parent_pid=os.getpid(),
pipe_handle=rhandle)
- cmd = ' '.join('"%s"' % x for x in cmd)
python_exe = spawn.get_executable()
# bpo-35797: When running in a venv, we bypass the redirect
# executor and launch our base Python.
if WINENV and _path_eq(python_exe, sys.executable):
- python_exe = sys._base_executable
+ cmd[0] = python_exe = sys._base_executable
env = os.environ.copy()
env["__PYVENV_LAUNCHER__"] = sys.executable
else:
env = None
+ cmd = ' '.join('"%s"' % x for x in cmd)
+
with open(wfd, 'wb', closefd=True) as to_child:
# start process
try: