test(code-runtime-python): resolve the interpreter path in the shell wrappers

The review's portability warning: the six shell wrappers exec'd a bare
'python3', which /bin/sh resolves against its compiled-in default PATH while
the runtime spawns with env:{} — in environments where python3 is reachable
only through the caller's PATH (Nix, pyenv) every wrapper run would fail as
worker-exit. The wrappers now bake the resolved absolute interpreter path
(module-level resolvePythonBin, which the product spawn already uses), and
resolvePythonBin is exported for the tests.
This commit is contained in:
Chinesezjc
2026-08-31 15:05:23 +08:00
committed by Tianyi Cui
parent 27b8f97150
commit 60b8fc00c4
2 changed files with 16 additions and 8 deletions
@@ -393,7 +393,7 @@ export function readProcessStart(pid: number): string | undefined {
* @param bin - the configured interpreter (absolute path or bare command).
* @returns an absolute path when resolvable, else `bin` unchanged.
*/
function resolvePythonBin(bin: string): string {
export function resolvePythonBin(bin: string): string {
if (isAbsolute(bin) || bin.includes('/')) return bin
const path = process.env.PATH
/* v8 ignore next -- PATH is set in every environment the runtime boots in; the guard is defensive. */