{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/14593","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/14593/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/14593/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/14593/events","html_url":"https://github.com/nodejs/node/issues/14593","id":247290325,"number":14593,"title":"Passing empty environment variables to child processes convert to 'undefined' using ConEmu + Node ","user":{"login":"nicojs","id":1828233,"avatar_url":"https://avatars3.githubusercontent.com/u/1828233?v=4","gravatar_id":"","url":"https://api.github.com/users/nicojs","html_url":"https://github.com/nicojs","followers_url":"https://api.github.com/users/nicojs/followers","following_url":"https://api.github.com/users/nicojs/following{/other_user}","gists_url":"https://api.github.com/users/nicojs/gists{/gist_id}","starred_url":"https://api.github.com/users/nicojs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicojs/subscriptions","organizations_url":"https://api.github.com/users/nicojs/orgs","repos_url":"https://api.github.com/users/nicojs/repos","events_url":"https://api.github.com/users/nicojs/events{/privacy}","received_events_url":"https://api.github.com/users/nicojs/received_events","type":"User","site_admin":false},"labels":[{"id":155267478,"url":"https://api.github.com/repos/nodejs/node/labels/child_process","name":"child_process","color":"f7c6c7","default":false},{"id":151728674,"url":"https://api.github.com/repos/nodejs/node/labels/confirmed-bug","name":"confirmed-bug","color":"fc2929","default":false},{"id":154312478,"url":"https://api.github.com/repos/nodejs/node/labels/in%20progress","name":"in progress","color":"ffff00","default":false},{"id":582285981,"url":"https://api.github.com/repos/nodejs/node/labels/v8.x","name":"v8.x","color":"1d76db","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":38,"created_at":"2017-08-02T06:53:53Z","updated_at":"2017-10-31T10:07:19Z","closed_at":null,"author_association":"NONE","body":"* **Version**:  Since Node 8.0.0. (tested in Node 7.9, Node 8.0.0 and Node 8.2.1)\r\n* **Platform**: Windows 10 version 1703 x64 using a shell (cmd.exe or git-bash) in [ConEmu](https://conemu.github.io/en)\r\n\r\n## Problem description\r\n\r\nWhen executing a process which spawns a child process, which in turn creates another child process, the empty environment variables are passed through as 'undefined' (the string literal, *NOT* an absent value). If you than for example do an `npm install` command from that child process, bad things happen:\r\n\r\n```\r\nnpm WARN invalid config access=undefined\r\nnpm WARN invalid config also=undefined\r\nnpm WARN invalid config https-proxy=undefined\r\nnpm WARN invalid config Must be a full url with \\'http://\\'\r\nnpm WARN onload-script     at Function.Module._resolveFilename (module.js:485:15)\r\nnpm WARN onload-script  { Error: Cannot find module \\'undefined\\'\r\n```\r\n\r\nTo my knowledge: this only happens in ConEmu, a popular console emulator on Windows. When i downgrade to node 7.9, this problem does not occur.\r\n\r\n## Steps to reproduce\r\n\r\nI created a small github repo to reproduce the problem.\r\n\r\n1. On windows 10: install ConEmu: https://conemu.github.io/\r\n1. Clone this repo `git clone git@github.com:nicojs/reproduce-conemu-child-process-environment-bug.git`\r\n1. run `npm install`.\r\n1. run `npm test`\r\n\r\nThis test spawns a child process, which in turn starts a new child process which logs the `process.env` to console. The tests verifies that `npm_config_onload_script` (one of the env variables) is set to `''`. \r\n\r\n## Actual results\r\n\r\nWhen ran from within ConEmu: the test failes\r\n\r\n1) the env should contain \"npm_config_onload_script\":\r\n     Error: \"npm_config_onload_script\": \"undefined\"!\"\r\n\r\nThe test also prints the environment variables to screen. You can see a lot of \"undefined\" values (the string literal, not an absent value).\r\n\r\nFor example: \"npm_config_onload_script\": \"undefined\",\r\n\r\n## Expected results\r\n\r\nIf ran from cmd or git-bash using mintty directly (or on a POSIX environment): the test passes\r\n\r\n√ should contain \"npm_config_onload_script\"\r\n\r\nIf you now look at the environment variables on screen, you don't see the \"undefined\" values. Just empty strings.\r\n\r\nFor example: \"npm_config_onload_script\": \"\",\r\n\r\nI reported this issue to ConEmu first, but the developer pointed out to me that this seems to be regression in node. See the discussion with [Maximus5](https://github.com/Maximus5) here: https://github.com/Maximus5/ConEmu/issues/1209\r\n\r\n## Screenshots:\r\n\r\n### ConEmu with cmd.exe shell\r\n\r\n![using-con-emu-cmd](https://user-images.githubusercontent.com/1828233/28861135-d8f04f2c-775f-11e7-8a60-2a065520c31f.png)\r\n\r\n### Command prompt with cmd.exe shell\r\n\r\n![using-command-promt-cmd](https://user-images.githubusercontent.com/1828233/28861176-059c4058-7760-11e7-8340-cce3c08ef658.png)\r\n"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/340716125","html_url":"https://github.com/nodejs/node/issues/14593#issuecomment-340716125","issue_url":"https://api.github.com/repos/nodejs/node/issues/14593","id":340716125,"user":{"login":"nicojs","id":1828233,"avatar_url":"https://avatars3.githubusercontent.com/u/1828233?v=4","gravatar_id":"","url":"https://api.github.com/users/nicojs","html_url":"https://github.com/nicojs","followers_url":"https://api.github.com/users/nicojs/followers","following_url":"https://api.github.com/users/nicojs/following{/other_user}","gists_url":"https://api.github.com/users/nicojs/gists{/gist_id}","starred_url":"https://api.github.com/users/nicojs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicojs/subscriptions","organizations_url":"https://api.github.com/users/nicojs/orgs","repos_url":"https://api.github.com/users/nicojs/repos","events_url":"https://api.github.com/users/nicojs/events{/privacy}","received_events_url":"https://api.github.com/users/nicojs/received_events","type":"User","site_admin":false},"created_at":"2017-10-31T10:07:19Z","updated_at":"2017-10-31T10:07:19Z","author_association":"NONE","body":"@v9Chris glad this issue could help you. I know the feeling  :metal:"}}
{"actor":{"display_login":"nicojs"}}