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 variable leading '=' truncated #6627

Closed
jcblw opened this issue May 7, 2016 · 4 comments
Closed

process.env variable leading '=' truncated #6627

jcblw opened this issue May 7, 2016 · 4 comments
Labels
macos Issues and PRs related to the macOS platform / OSX. process Issues and PRs related to the process subsystem.

Comments

@jcblw
Copy link

jcblw commented May 7, 2016

  • Version: 6.0.0
  • Platform: 15.0.0 Darwin RELEASE_X86_64
  • Subsystem: process

Hello

I just recently got a ticket filed on a npm module, dotenv, I help maintain. It has to do with a "=" being at the front of an environment variable. While investigating I noticed our parser was picking up on this character fine, but when trying to use dotenv's preload option the tests started failing. After seeing those test I tried to just load the env directly into node.

TEST='=FOO' node -e 'console.log(process.env.TEST)'
TEST==FOO node -e 'console.log(process.env.TEST)'
TEST="=FOO" node -e 'console.log(process.env.TEST)'

All of these commands output FOO to the console with no equal sign. Looking at the test node has been doing this for a few versions. Is this intended behavior?

@addaleax addaleax added process Issues and PRs related to the process subsystem. macos Issues and PRs related to the macOS platform / OSX. labels May 7, 2016
@addaleax
Copy link
Member

addaleax commented May 7, 2016

See also: nodejs/node-v0.x-archive#8467

This seems to be the result of an OS X/BSD implementation detail, and apparently stripping the leading = occurs when setting the variable, not in Node.js. I don’t think there’s anything that can be done against this.

@Fishrock123
Copy link
Member

Works for me under OS X 10.10.5 and bash 3.2.

$ TEST='=foo' node -p process.env.TEST
> =foo

@jcblw What shell are you using?

@S-YOU
Copy link

S-YOU commented May 7, 2016

just fyi, my zsh also same result as him, node 6.1, osx mavericks, but osx bash, and linux zsh seems ok.

@jcblw
Copy link
Author

jcblw commented May 7, 2016

@Fishrock123 I am using ZSH. I did login with bash and the leading = is retained. Sorry for not investigating this more. This does seems to be an issue with running node while using ZSH. Closing.

Thanks for the help!

@jcblw jcblw closed this as completed May 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
macos Issues and PRs related to the macOS platform / OSX. process Issues and PRs related to the process subsystem.
Projects
None yet
Development

No branches or pull requests

4 participants