diff options
author | Steve Dower <steve.dower@python.org> | 2022-10-20 13:53:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-20 13:53:38 (GMT) |
commit | e48f9b2b7e73f4a89a9b9c287f3b93dc13a60460 (patch) | |
tree | 31dfc7cb8b10e661fb2b7ca1a608fce98f130884 /Lib/multiprocessing | |
parent | cb93b4aee5eb12dc6c4b2dccc81a2e5ace3ea4de (diff) | |
download | cpython-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')
-rw-r--r-- | Lib/multiprocessing/popen_spawn_win32.py | 5 |
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: |