Skip to content

Commit 749270f

Browse files
authored
fix(ext/node): include prototype env vars in child_process spawn (#32699)
The env key collection loop had `Object.hasOwn()` filtering despite the comment saying "Prototype values are intentionally included". This made `for...in` pointless since it only kept own properties. Node.js includes prototype-chain env vars when spawning child processes, and this test explicitly verifies that behavior.
1 parent b177ff6 commit 749270f

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

ext/node/polyfills/internal/child_process.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,10 +1148,9 @@ export function normalizeSpawnArguments(
11481148

11491149
let envKeys: string[] = [];
11501150
// Prototype values are intentionally included.
1151+
// deno-lint-ignore guard-for-in
11511152
for (const key in env) {
1152-
if (Object.hasOwn(env, key)) {
1153-
ArrayPrototypePush(envKeys, key);
1154-
}
1153+
ArrayPrototypePush(envKeys, key);
11551154
}
11561155

11571156
if (process.platform === "win32") {

tests/node_compat/config.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@
205205
"parallel/test-child-process-detached.js": {},
206206
"parallel/test-child-process-disconnect.js": {},
207207
"parallel/test-child-process-double-pipe.js": {},
208+
"parallel/test-child-process-env.js": {},
208209
"parallel/test-child-process-exec-cwd.js": {},
209210
"parallel/test-child-process-exec-env.js": {},
210211
"parallel/test-child-process-exec-error.js": {},

0 commit comments

Comments
 (0)