-
-
Notifications
You must be signed in to change notification settings - Fork 203
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
Change default behavior of extendEnv
to false
#394
Comments
I think the idea behind the I personally agree with that view so I would not modify the default value. However I would like to know what's the opinion of @sindresorhus about this? |
In a void I might agree, but because this module defers to the documentation for My use case is specifically that I need to pass a subset of the current const env = Object.keys(opts.env || process.env).reduce((e, key) => {
// remove npm environment
if (key.startsWith('npm_')) {
return e
}
e[key] = process.env[key]
return e
}, {})
await execa(/* ... */, { env }) Obviously, this was not the behavior I expected because, well, here I am :) So my case here is not really that one approach is better, but more that because node core is the canonical implementation and any deviation is unexpected unless very clearly documentd (as #390 would hopefully do). |
@wesleytodd I hear you :) |
extendEnv
to false
I think the current behavior is more user-friendly, so I wouldn't want to change that. We should rather more clearly indicate the how the behavior is different and also defer less to the |
I agree. Changing the documentation is covered by #390: I will update that issue accordingly. |
I can see how for small additions to the env it is nice the way it is. And I agree that with better docs I might not have had this expectation. Thanks for considering it! |
Thanks @wesleytodd for bringing this issue up! |
As discussed in #390, the behavior is documented a bit confusingly, which for my use meant I was getting unexpected behavior when just passing a new
env
object which I assumed behaved likechild_process
and would fully replace. I brought up there the idea of changing the default behavior to align with node core's behavior. If noone has objections I can open a PR with the following change:execa/index.js
Line 18 in 717d29d
The text was updated successfully, but these errors were encountered: