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.toString() fails #9641

Closed
bzoz opened this issue Nov 16, 2016 · 1 comment
Closed

process.env.toString() fails #9641

bzoz opened this issue Nov 16, 2016 · 1 comment
Labels
process Issues and PRs related to the process subsystem.

Comments

@bzoz
Copy link
Contributor

bzoz commented Nov 16, 2016

  • Version: current master
  • Platform: Ubuntu 64-bit

node -e 'process.env.toString()' gives error:

[eval]:1
process.env.toString()
            ^

TypeError: Cannot convert a Symbol value to a string
    at Object.toString (<anonymous>)
    at [eval]:1:13
    at ContextifyScript.Script.runInThisContext (vm.js:26:33)
    at Object.exports.runInThisContext (vm.js:79:17)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:573:32)
    at Immediate.<anonymous> (bootstrap_node.js:383:29)
    at runCallback (timers.js:637:20)
    at tryOnImmediate (timers.js:610:5)
    at processImmediate [as _immediateCallback] (timers.js:582:5)

This works as expected with v7.1.0.

@cjihrig
Copy link
Contributor

cjihrig commented Nov 16, 2016

See #9631

@mscdex mscdex added the process Issues and PRs related to the process subsystem. label Nov 16, 2016
italoacasas pushed a commit to italoacasas/node that referenced this issue Jan 18, 2017
1aa595e introduced a `throw` for accessing `Symbol` properties of
`process.env`. However, this breaks `util.inspect(process)` and
things like `Object.prototype.toString.call(process.env)`, so this
patch changes the behaviour for the getter to just always return
`undefined`.

Ref: nodejs#9446
Fixes: nodejs#9641
PR-URL: nodejs#9631
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
process Issues and PRs related to the process subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants