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

process.env.PATH not set correctly on windows #91

Closed
janni83 opened this issue Nov 24, 2014 · 3 comments
Closed

process.env.PATH not set correctly on windows #91

janni83 opened this issue Nov 24, 2014 · 3 comments
Labels
Milestone

Comments

@janni83
Copy link

janni83 commented Nov 24, 2014

Hi guys,

I just played a bit with the "which" module from npm which uses the process.env.PATH variable to find a executable file, but it couldn't find cmd.exe or java.exe on my system because process.env.PATH was empty. After I had a deeper look into this I found found that the PATH variable on my windows system is called "Path" and not "PATH".

var which = require("which");

// does not find java
which("java", function(err, result) {
  if (err) {
    return console.log(err);
  }
  console.log(result);
});

process.env.PATH = process.env.Path;

// now it works
which("java", function(err, result) {
  if (err) {
    return console.log(err);
  }
  console.log(result);
});

@gbrail
Copy link
Contributor

gbrail commented Dec 1, 2014

It looks like "regular" node uses the underlying Windows code to get and set environment variables for the process, and that it does this in a case-insensitive way, except for enumeration.

In other words, you can get any environment variable from process.env regardless of case, but when you enumerate them, process.env only shows the uppercased versions.

I'll update Trireme to work this way as well. Thanks for tracking this down!

@gbrail gbrail added this to the 0.8.4 milestone Dec 2, 2014
@gbrail
Copy link
Contributor

gbrail commented Dec 2, 2014

I changed Trireme to make this comparison case-insensitive. Could you please try it out? The fix is in the "master" branch, and also in the maven central "snapshot" repository for the 0.8.4-SNAPSHOT version.

@gbrail gbrail closed this as completed Dec 2, 2014
@janni83
Copy link
Author

janni83 commented Dec 8, 2014

Hey,

I just tried it with 0.8.4 and everything works fine.

Thank you!

Best,

Jan

2014-12-02 23:43 GMT+01:00 Greg Brail [email protected]:

I changed Trireme to make this comparison case-insensitive. Could you
please try it out? The fix is in the "master" branch, and also in the maven
central "snapshot" repository for the 0.8.4-SNAPSHOT version.


Reply to this email directly or view it on GitHub
#91 (comment).

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

No branches or pull requests

2 participants