Skip to content

Commit 5876063

Browse files
authored
gh-127503 Don't propagate native PATH to Emscripten Python (#127633)
Modifies the handling of PATH to ensure that native executables aren't picked up when running under node.
1 parent be07edf commit 5876063

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Tools/wasm/emscripten/node_entry.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ const settings = {
3535
mountDirectories(Module);
3636
Module.FS.chdir(process.cwd());
3737
Object.assign(Module.ENV, process.env);
38+
delete Module.ENV.PATH;
3839
},
3940
// Ensure that sys.executable, sys._base_executable, etc point to python.sh
4041
// not to this file. To properly handle symlinks, python.sh needs to compute
4142
// its own path.
42-
thisProgram: process.argv[thisProgramIndex],
43+
thisProgram: process.argv[thisProgramIndex].slice(thisProgram.length),
4344
// After python.sh come the arguments thatthe user passed to python.sh.
4445
arguments: process.argv.slice(thisProgramIndex + 1),
4546
};

0 commit comments

Comments
 (0)