Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node:child_process always inherits parent env variables #27343

Open
TateKennington opened this issue Dec 12, 2024 · 0 comments · May be fixed by #27340
Open

node:child_process always inherits parent env variables #27343

TateKennington opened this issue Dec 12, 2024 · 0 comments · May be fixed by #27340

Comments

@TateKennington
Copy link

Version: Deno 2.1.3

Hi there 👋

I'm currently experiencing an issue where Deno's node:child_process polyfill is always passing the parent process's environment to spawned subprocesses even when the env option is provided. On Node it looks like the correct behaviour is for the parent environment to be inherited only when env isn't specified, otherwise only the values from env are passed to the environment.

For example, the code:

import child_process from 'node:child_process'

child_process.spawnSync('env', { env: { test: 'test' } }).stdout.toString('utf8')

When run on Node only outputs 'test=test\n' but when run on Deno outputs the full parent environment in addition to test=test.

I've had a go at fixing this in #27340 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant