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

The PATH key in process.env is not upcased #22578

Closed
zzhengjian opened this issue Aug 29, 2018 · 7 comments
Closed

The PATH key in process.env is not upcased #22578

zzhengjian opened this issue Aug 29, 2018 · 7 comments
Labels
windows Issues and PRs related to the Windows platform.

Comments

@zzhengjian
Copy link

zzhengjian commented Aug 29, 2018

image

image

Anyone know how to resolve it?

@vsemozhetbyt
Copy link
Contributor

If I am not mistaken, this cannot hurt:

On Windows operating systems, environment variables are case-insensitive.

@AyushG3112
Copy link
Contributor

@zzhengjian are you able to access the path via process.env.PATH?

@refack
Copy link
Contributor

refack commented Aug 29, 2018

@zzhengjian what does windows native tools show (e.g. cmd)

For me it's:
image

@refack refack added the windows Issues and PRs related to the Windows platform. label Aug 29, 2018
@bzoz
Copy link
Contributor

bzoz commented Aug 29, 2018

Environment variables are case-insensitive on Windows. I'll close this issue, if you can provide an example where this difference in case matters, feel free to reopen this issue.

@bzoz bzoz closed this as completed Aug 29, 2018
@zzhengjian
Copy link
Author

Hi,
You can refer to this issue: SeleniumHQ/selenium#5913
I'm having this issue when i use cmd to launch selenium-webdriver in nodejs version.

@zzhengjian
Copy link
Author

zzhengjian commented Aug 30, 2018

@AyushG3112 @refack
I can access with process.env.PATH and process.env['PATH']
image

@ghost
Copy link

ghost commented Aug 30, 2018

IIUC, the selenium module redefines process.env. It's not something Node.js can prevent. Node's original process.env is case-insensitive, while the redefined one is not.

Can you try this and let me know if it works for you:

process.env = new Proxy(process.env, {
  get(env, prop){
    return env[prop.toUpperCase()];
  },

  set(env, prop, val){
    env[prop.toUpperCase()] = String(val);
    return 1;
  },
});

console.log(process.env.Path);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

5 participants