fix(process): apply undefined env removals#107258
Conversation
Co-authored-by: Pavan Kumar Gondhi <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f19ff94d42
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (params.value === undefined) { | ||
| delete params.env[params.key]; | ||
| return; |
There was a problem hiding this comment.
Honor explicit PATH removals during lookup
When a Windows caller removes an inherited PATH/Path while spawning a bare command, e.g. baseEnv: { Path: ... }, env: { PATH: undefined }, this branch deletes all spellings from the merged child env. resolveSafeChildProcessInvocation then calls the Windows resolver, whose missing-PATH fallback uses process.env (src/process/windows-command.ts:79-82), so the child no longer gets the intended PATH but the executable is still selected from the ambient parent PATH. That makes explicit undefined removal launch the wrong binary instead of failing or honoring the isolated env.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
Co-authored-by: Pavan Kumar Gondhi <[email protected]>
Related: #107248
What Problem This Solves
Resolves a regression where explicit
undefinedchild-environment overrides were ignored. That could preserve inherited variables instead of removing them, including case-insensitive Windows keys. The same regression also left duplicate unused helpers inexec.ts, breaking type and lint gates onmain.Why This Change Was Made
Undefined-value deletion now lives in the canonical
exec-spawn.tsenvironment merge path. The unused duplicate implementation is deleted fromexec.ts.User Impact
Callers can reliably remove inherited child-process environment variables. Current
maintype, lint, and process test failures are repaired.Evidence
tbx_01kxfrgjna33j431bjzz0medm1: 38 process exec tests passed, 1 skipped.pnpm tsgo:corepassed.src/process/exec.tsandsrc/process/exec-spawn.ts.Recreates #107248 because its branch is not maintainer-writable. Preserves contributor credit via
Co-authored-by.