-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Make "process.env" case insensitive in Windows #5465
Conversation
const BLACKLIST = new Set(['mainModule', '_events']); | ||
const BLACKLIST = new Set(['env', 'mainModule', '_events']); | ||
|
||
function createProcessEnv() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be helpful to point to the process.env
docs somewhere here (e.g. I wasn't aware of this, TIL): https://nodejs.org/api/process.html#process_process_env
CI failures are completely unrelated, what the heck CircleCI? |
It's trying to use what it seems to be a corrupted cache layer ("Found a cache from build 13420 at |
I'm going to merge this. CircleCI looks corrupted, but tests passed in AppVeyor. |
@@ -30,3 +30,47 @@ it('creates a process object that looks like the original one', () => { | |||
it('fakes require("process") so it is equal to "global.process"', () => { | |||
expect(require('process') === process).toBe(true); | |||
}); | |||
|
|||
it('checks that process.env works as expected on Linux platforms', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add a test for delete process.env.PROP
as well?
Change looks great 🙂 Missing changelog entry 😱 |
@SimenB Good catch on the |
@mjesun It is case insensitive: |
What about |
Thanks! I will implement that behavior as well 🙂 |
And that is the story of how we started using Proxies in production… :D |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
When we fully sandboxed
process
, we removed the ability of theenv
object to perform case-insensitive matches when used in Windows. The proposed solution uses aProxy
instance over a shared prototype object, and emulates the behavior by using a secondary lookup object.Another behavior that
process.env
has is that all values are always stored as strings, regardless of their value (numbers, booleans...). This behavior has also been mimicked in the new implementation.Tests were also added to ensure that both behaviors are well respected in different platforms. Fixes #5322.