doc: document process.env better

Fixes #6424.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
This commit is contained in:
Maciej Małecki 2013-11-11 20:51:34 +01:00 committed by Fedor Indutny
parent 7c5fabe405
commit 0664ddc093

View File

@ -276,6 +276,29 @@ Returns the current working directory of the process.
An object containing the user environment. See environ(7).
An example of this object looks like:
{ TERM: 'xterm-256color',
SHELL: '/usr/local/bin/bash',
USER: 'maciej',
PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin',
PWD: '/Users/maciej',
EDITOR: 'vim',
SHLVL: '1',
HOME: '/Users/maciej',
LOGNAME: 'maciej',
_: '/usr/local/bin/node' }
You can write to this object, but changes won't be reflected outside of your
process. That means that the following won't work:
node -e 'process.env.foo = "bar"' && echo $foo
But this will:
process.env.foo = 'bar';
console.log(process.env.foo);
## process.exit([code])