Repository navigation
[v24.x backport] child_process: inherit a reassigned process.env - #67921
Closed
everett1992 wants to merge 1 commit into
Closed
everett1992 wants to merge 1 commit into
everett1992 wants to merge 1 commit into
Conversation
Since v26.11.0, spawning without options.env builds the child's
environment from the OS environment block. Code that replaces
process.env, e.g. process.env = { ...process.env, FOO: 'x' }, had its
changes silently dropped. The child_process docs give process.env as
the default for options.env, and { env: process.env } still saw the
replacement object, so the two disagreed.
Make getEnvPairs() take the object to read and return undefined unless
it is still the native env proxy. When it isn't, copy process.env as
before. A plain object is copied without going through the env
interceptors, so that path stays cheap.
Assisted-by: a closed-source coding agent
Signed-off-by: Caleb ツ Everett <calebev@amazon.com>
PR-URL: nodejs#66883
Fixes: nodejs#66882
Refs: nodejs#65325
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v24.x-staging #67921 +/- ##
=================================================
+ Coverage 90.31% 90.42% +0.11%
=================================================
Files 711 717 +6
Lines 228425 241949 +13524
Branches 43160 46207 +3047
=================================================
+ Hits 206293 218785 +12492
- Misses 14090 14611 +521
- Partials 8042 8553 +511
🚀 New features to boost your workflow:
|
Member
|
These are only needed for PRs that don't land cleanly. |
Contributor
Author
|
@Renegade334 Any ETA to land the fix on v24 then? I was pretty surprised to see the bug backported without it's fix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #66883 to v24.x.
v24.23.0 includes the bug from #65325 (da67ac7) but not its fix, so v24 now has the regression from #66882: a child spawned without
options.envignores a reassignedprocess.env.The repro from #66882 prints
seton v24.22.3 andundefinedon v24.23.0.The commit cherry-picks cleanly onto
v24.x-staging, and its message is unchanged.make -j64 testpasses on Linux x64 (gcc 14): 5879 JS tests and 260 cctests, no failures.Refs: #66883
Refs: #66882