process.env - documentation?

366 views
Skip to first unread message

Bgsosh

unread,
Oct 31, 2012, 9:04:59 AM10/31/12
to nod...@googlegroups.com
Hi, I'm tring to understand the structure of the process.env object, but the online docs just say 'An object containing the user environment. See environ(7).'

I can't find 'environ(7)' (whatever that is!).  Is this documented somewhere?

Thanks

Arnout Kazemier

unread,
Oct 31, 2012, 9:08:02 AM10/31/12
to nod...@googlegroups.com

It's just an object that contains all your env. variables.
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

SL

unread,
Oct 31, 2012, 9:20:01 AM10/31/12
to nod...@googlegroups.com
Ok, thanks!  Would be good if someone could clarify that in the docs.

Jorge

unread,
Oct 31, 2012, 10:59:23 AM10/31/12
to nodejs
Type this in the terminal:

$ man 7 environ

ENVIRON(7) BSD Miscellaneous Information Manual
ENVIRON(7)

NAME
environ -- user environment

SYNOPSIS
extern char **environ;

DESCRIPTION
An array of strings called the environment is made available by
execve(2) when a process
begins. By convention these strings have the form
``name=value''. The following names are
used by various commands:

BLOCKSIZE The size of the block units used by several commands,
most notably df(1), du(1) and
ls(1). BLOCKSIZE may be specified in units of a byte
by specifying a number, in
units of a kilobyte by specifying a number followed by
``K'' or ``k'', in units of a
megabyte by specifying a number followed by ``M'' or
``m'' and in units of a giga-
byte by specifying a number followed by ``G'' or
``g''. Sizes less than 512 bytes
or greater than a gigabyte are ignored.

EXINIT A startup list of commands read by ex(1), edit(1), and
vi(1).

...
--
Jorge.

Scott Elcomb

unread,
Oct 31, 2012, 12:26:21 PM10/31/12
to nod...@googlegroups.com
On Wed, Oct 31, 2012 at 10:59 AM, Jorge
<jorge%jorgecha...@gtempaccount.com> wrote:
> On Oct 31, 2:04 pm, Bgsosh <bgs...@gmail.com> wrote:
>> Hi, I'm tring to understand the structure of the process.env object, but
>> the online docs just say 'An object containing the user environment. See
>> environ(7).'
>>
>> I can't find 'environ(7)' (whatever that is!). Is this documented
>> somewhere?
>
> Type this in the terminal:
>
> $ man 7 environ

That'd be tricky for Windows users to do if they're not running a
*nix-like shell. (Cygwin comes to mind)

I'd imagine the best bet for Windows users would be to search for "man
7 environ" on the web to find a copy of the relevant man page; there
are a number of mirrors like the one Adam suggested.

(BTW, for those not familiar with man pages, see also
<http://en.wikipedia.org/wiki/Man_page>)

--
Scott Elcomb
@psema4 on Twitter / Identi.ca / Github & more

Atomic OS: Self Contained Microsystems
http://code.google.com/p/atomos/

Member of the Pirate Party of Canada
http://www.pirateparty.ca/

Jorge

unread,
Oct 31, 2012, 1:46:28 PM10/31/12
to nodejs
On 31 oct, 17:26, Scott Elcomb <pse...@gmail.com> wrote:
> On Wed, Oct 31, 2012 at 10:59 AM, Jorge
>
> <jorge%jorgechamorro....@gtempaccount.com> wrote:
> > On Oct 31, 2:04 pm, Bgsosh <bgs...@gmail.com> wrote:
> >> Hi, I'm tring to understand the structure of the process.env object, but
> >> the online docs just say 'An object containing the user environment. See
> >> environ(7).'
>
> >> I can't find 'environ(7)' (whatever that is!).  Is this documented
> >> somewhere?
>
> > Type this in the terminal:
>
> > $ man 7 environ
>
> That'd be tricky for Windows users to do if they're not running a
> *nix-like shell. (Cygwin comes to mind)
>
> I'd imagine the best bet for Windows users would be to search for "man
> 7 environ" on the web to find a copy of the relevant man page; there
> are a number of mirrors like the one Adam suggested.
>
> (BTW, for those not familiar with man pages, see also
> <http://en.wikipedia.org/wiki/Man_page>)


Perhaps Windowzs users should better search for "environment
variables" @ msdn or something, I guess, yeah.
--
Jorge.

Scott Elcomb

unread,
Oct 31, 2012, 5:49:59 PM10/31/12
to nod...@googlegroups.com
Um, yeah.  Good point.

<slinks back to the nearest bash shell>
 

SL

unread,
Oct 31, 2012, 7:28:14 PM10/31/12
to nod...@googlegroups.com
Or we could make the docs a bit clearer...

Matt

unread,
Nov 1, 2012, 9:13:26 AM11/1/12
to nod...@googlegroups.com
If the docs covered every aspect of how programming networks, child processes, systems and filesystems worked they would be huge.

There's a place for tutorials though - but it's not in the core docs IMHO. If you don't know what an environment variable is then you have some basic learning to do before diving straight into programming.

SL

unread,
Nov 1, 2012, 12:16:00 PM11/1/12
to nod...@googlegroups.com
Wow, thanks for the condescending and arrogant comment!  I'm not suggesting there should be a 'tutorial' about any of those things you mentioned.  However the docs at the moment are IMO a bit ambiguous about this point - it just says "An object containing the user environment. See environ(7)."  I didn't realise immediately that this is talking about the OS environment variables - I'm sure I'm not the only one.

SL

unread,
Nov 1, 2012, 12:20:25 PM11/1/12
to nod...@googlegroups.com
That's what I initially assumed it related to.

On 1 November 2012 15:11, Alex Kocharin <al...@equenext.com> wrote:

I think that common nodejs related env variables like NODE_ENV or NODE_DEBUG should be there, but there's no need to add any others.

Chad Engler

unread,
Nov 1, 2012, 12:34:39 PM11/1/12
to nod...@googlegroups.com

It wasn’t condescending; “topic(page#)” like “environ(7)” is a very common way to express man pages, and if you aren’t aware of what the user environment is you should probably do more research. Had you typed “environ(7)” into google before getting butthurt at the docs, you probably would have found out exactly what it was with no help from anyone. There is no reason to repost the manual page since there is already a manual page for it, the docs are fine the way they are; you just need to try to look a little harder, or be grateful when people help.

 

-Chad

Tim Caswell

unread,
Nov 1, 2012, 12:42:00 PM11/1/12
to nod...@googlegroups.com
I've been using since before it was popular. Back in the early days,
the docs for node were full of references to linux man pages like
this. My background was scripting languages and I had never done any
C programming so I had no clue what readdir(3) meant. To open a file
back then you had to manually bitwise OR the various unix flags
together yourself. (Using "r", "w", "a", etc was an addition I made)

Things now are much easier for people without a C background and there
are many fewer parts left in the docs that assume knowledge of man
pages.

That said, I did eventually figure out it was referencing man pages.
I was a linux user after all, I had just never used man to lookup C
APis.

How about we just link to one of the man mirrors in the API docs? I
was an experienced linux user and I still didn't know what the docs
were talking about, I can only imagine how confused windows users
would be.

Matt

unread,
Nov 1, 2012, 12:48:45 PM11/1/12
to nod...@googlegroups.com
You maybe misread me - I *am* suggesting there should be a tutorial about those things. I just think it belongs outside of the node core docs. Or in a book.

The node core docs should give you exactly accurate minimal information to point you in the right direction (aka google) if you need/want to know more.

SL

unread,
Nov 1, 2012, 12:48:56 PM11/1/12
to nod...@googlegroups.com
As you guessed, I'm developing on Windows.  Thanks for the understanding!  Yes a link would have avoided all confusion.

Chad Engler

unread,
Nov 1, 2012, 12:58:08 PM11/1/12
to nod...@googlegroups.com

I really think all of this could have been avoided, and new knowledge consumed using this simple process that has guided me for years:

 

1.       Encounter unknown term, phrase, or idea

2.       Copy unknown term, phrase, or idea to clipboard

3.       Paste unknown term, phrase, or idea into a search engine search bar (I tend to use Google)

4.       Select “Search”

5.       View results, which 98% of the time will clear up confusion.

 

If this process fails, then repeat using similar terms. If that also fails, then I usually head to StackOverflow/mailing lists.

 

My point was there was no attempt to solve this besides “tell me what I need to know” and “We should fix the docs so people who have never developed before can use them.”

SL

unread,
Nov 1, 2012, 1:01:06 PM11/1/12
to nod...@googlegroups.com
Ok, last post as the vibe here is a distinctly unfriendly... It's quite simple: When I read 'see environ(7)' I assumed that was a reference to another part of the node docs.  When a reference is made to another source, I'm used to seeing the source named.  If it had said 'see: man-pages environ(7)' there probably would have been no misunderstanding.

Chad Engler

unread,
Nov 1, 2012, 1:02:36 PM11/1/12
to nod...@googlegroups.com

Ill repeat myself for the third time now: If you see something and are confused on what it means, Google is a great starting point. Had you attempting to figure it out on your own, you would have seen the first link, felt silly, and moved on.

Chad Engler

unread,
Nov 1, 2012, 1:04:17 PM11/1/12
to nod...@googlegroups.com

Also, the unfriendliness stems from the fact that after answering your question, you didn’t like it. So we answered a different way, and you called us condescending. Which means that normal conversation doesn’t work, so I have to try a different approach; actually being condescending.

Dan Milon

unread,
Nov 1, 2012, 1:19:08 PM11/1/12
to nod...@googlegroups.com
I totally agree with Tim & SL here.

I think the argument: "If you google'ed you'd find out" is invalid. The
same argument could be used for almost every question in this mailing list.

To keep away from over-documenting I agree with Tim, at least there
should be a link to an online man page.
But I also find the "user variables" term misleading. I dont know whats
the official term, but i always refer to them as "environmental variables".

danmilon.

On 11/01/2012 07:02 PM, Chad Engler wrote:
> Ill repeat myself for the third time now: If you see something and are
> confused on what it means, Google is a great starting point. Had you
> attempting to figure it out on your own, you would have seen the first
> link, felt silly, and moved on.
>
>
>
> -Chad
>
>
>
> *From:*nod...@googlegroups.com [mailto:nod...@googlegroups.com] *On
> Behalf Of *SL
> *Sent:* Thursday, November 01, 2012 1:01 PM
> *To:* nod...@googlegroups.com
> *Subject:* Re: [nodejs] Re: process.env - documentation?
>
>
>
> Ok, last post as the vibe here is a distinctly unfriendly... It's quite
> simple: When I read 'see environ(7)' I assumed that was a reference to
> another part of the node docs. When a reference is made to another
> source, I'm used to seeing the source named. If it had said 'see:
> man-pages environ(7)' there probably would have been no misunderstanding.
>
>
>
>
>
> On 1 November 2012 17:58, Chad Engler <Chad....@patlive.com
> <mailto:Chad....@patlive.com>> wrote:
>
> I really think all of this could have been avoided, and new knowledge
> consumed using this simple process that has guided me for years:
>
>
>
> 1. Encounter unknown term, phrase, or idea
>
> 2. Copy unknown term, phrase, or idea to clipboard
>
> 3. Paste unknown term, phrase, or idea into a search engine search
> bar (I tend to use Google)
>
> 4. Select “Search”
>
> 5. View results, which 98% of the time will clear up confusion.
>
>
>
> If this process fails, then repeat using similar terms. If that /also/
> fails, then I usually head to StackOverflow/mailing lists.
>
>
>
> My point was there was no attempt to solve this besides “tell me what I
> need to know” and “We should fix the docs so people who have never
> developed before can use them.”
>
>
>
> -Chad
>
>
>
> *From:*nod...@googlegroups.com <mailto:nod...@googlegroups.com>
> [mailto:nod...@googlegroups.com <mailto:nod...@googlegroups.com>] *On
> Behalf Of *SL
> *Sent:* Thursday, November 01, 2012 12:49 PM
>
>
> *To:* nod...@googlegroups.com <mailto:nod...@googlegroups.com>
> *Subject:* Re: [nodejs] Re: process.env - documentation?
>
>
>
> As you guessed, I'm developing on Windows. Thanks for the
> understanding! Yes a link would have avoided all confusion.
>
> On 1 November 2012 17:42, Tim Caswell <t...@creationix.com
> <mailto:hel...@gmail.com>> wrote:
>>
>> If the docs covered every aspect of how programming networks, child
>> processes, systems and filesystems worked they would be huge.
>>
>>
>>
>> There's a place for tutorials though - but it's not in the core docs IMHO.
>> If you don't know what an environment variable is then you have some basic
>> learning to do before diving straight into programming.
>>
>>
>>
>> On Wed, Oct 31, 2012 at 7:28 PM, SL <bgs...@gmail.com
> <mailto:bgs...@gmail.com>> wrote:
>>
>> Or we could make the docs a bit clearer...
>>
>>
>>
>> On 31 October 2012 18:46, Jorge
> <jorge%jorgecha...@gtempaccount.com
> <mailto:jorge%25jorgech...@gtempaccount.com>>
>> wrote:
>>
>> On 31 oct, 17:26, Scott Elcomb <pse...@gmail.com
> <mailto:pse...@gmail.com>> wrote:
>>> On Wed, Oct 31, 2012 at 10:59 AM, Jorge
>>>
>>
>>> <jorge%jorgechamorro....@gtempaccount.com
> <mailto:jorge%25jorgechamorro....@gtempaccount.com>> wrote:
>>> > On Oct 31, 2:04 pm, Bgsosh <bgs...@gmail.com
> <mailto:nod...@googlegroups.com>
>> To unsubscribe from this group, send email to
>> nodejs+un...@googlegroups.com
> <mailto:nodejs%2Bunsu...@googlegroups.com>
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>>
>>
>> --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to nod...@googlegroups.com
> <mailto:nod...@googlegroups.com>
>> To unsubscribe from this group, send email to
>> nodejs+un...@googlegroups.com
> <mailto:nodejs%2Bunsu...@googlegroups.com>
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>>
>>
>> --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to nod...@googlegroups.com
> <mailto:nod...@googlegroups.com>
>> To unsubscribe from this group, send email to
>> nodejs+un...@googlegroups.com
> <mailto:nodejs%2Bunsu...@googlegroups.com>
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>>
>>
>> --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to nod...@googlegroups.com
> <mailto:nod...@googlegroups.com>
>> To unsubscribe from this group, send email to
>> nodejs+un...@googlegroups.com
> <mailto:nodejs%2Bunsu...@googlegroups.com>
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>> --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to nod...@googlegroups.com
> <mailto:nod...@googlegroups.com>
>> To unsubscribe from this group, send email to
>> nodejs+un...@googlegroups.com
> <mailto:nodejs%2Bunsu...@googlegroups.com>
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> <mailto:nod...@googlegroups.com>
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> <mailto:nodejs%2Bunsu...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
>
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> <mailto:nod...@googlegroups.com>
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> <mailto:nodejs+un...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> <mailto:nod...@googlegroups.com>
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> <mailto:nodejs%2Bunsu...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
>
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> <mailto:nod...@googlegroups.com>
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> <mailto:nodejs+un...@googlegroups.com>

Tim Caswell

unread,
Nov 1, 2012, 1:21:09 PM11/1/12
to nod...@googlegroups.com
On Thu, Nov 1, 2012 at 12:04 PM, Chad Engler <Chad....@patlive.com> wrote:
> Also, the unfriendliness stems from the fact that after answering your
> question, you didn’t like it. So we answered a different way, and you called
> us condescending. Which means that normal conversation doesn’t work, so I
> have to try a different approach; actually being condescending.
>

Chad, please be nicer. Yes, he could have easily pasted the unknown
term into google. That's exactly what I did when I had the same
problem years ago. That doesn't change the fact that a part of the
node docs are hard to understand to part of our audience. We should
thank the OP for pointing this out and helping us make node better for
others in the future.

Chad Engler

unread,
Nov 1, 2012, 2:11:43 PM11/1/12
to nod...@googlegroups.com
People not Google'ing before asking the mailing list is exactly why I
have 500 messages a day from this list, and can barely find interesting
topics; and I am really tired of getting "how does one node" and "what
is javascript" questions here.

I agree that a link on the docs is useful, but I also think searching is
just as easy.

"environment variables" can refer to "user variables" or "system
variables". The "environment variables" can also be called the "user
environment" as the node.js docs do. It is a little misleading due to
the distinction on windows systems.

-Chad
Reply all
Reply to author
Forward
0 new messages