Merge branch 'master' into ns-switch-to-display-layers

This commit is contained in:
Antonio Scandurra
2016-04-17 10:06:16 +02:00
2 changed files with 17 additions and 6 deletions

View File

@@ -101,7 +101,7 @@
"link": "0.31.1",
"markdown-preview": "0.158.0",
"metrics": "0.53.1",
"notifications": "0.63.1",
"notifications": "0.63.2",
"open-on-github": "1.1.0",
"package-generator": "1.0.0",
"settings-view": "0.235.1",
@@ -110,7 +110,7 @@
"status-bar": "1.2.3",
"styleguide": "0.45.2",
"symbols-view": "0.112.0",
"tabs": "0.92.1",
"tabs": "0.92.2",
"timecop": "0.33.1",
"tree-view": "0.206.0",
"update-package-dependencies": "0.10.0",

View File

@@ -67,9 +67,20 @@ function needsPatching (options = { platform: process.platform, env: process.env
return false
}
// Fix for #11302 because `process.env` on Windows is a magic object that offers case-insensitive
// environment variable matching. By always cloning to `process.env` we prevent breaking the
// underlying functionality.
function clone (to, from) {
for (var key in to) {
delete to[key]
}
Object.assign(to, from)
}
function normalize (options = {}) {
if (options && options.env) {
process.env = options.env
clone(process.env, options.env)
}
if (!options.env) {
@@ -85,8 +96,8 @@ function normalize (options = {}) {
// in #4126. Retain the original in case someone needs it.
let shellEnv = getFromShell()
if (shellEnv && shellEnv.PATH) {
process._originalEnv = process.env
process.env = shellEnv
process._originalEnv = Object.assign({}, process.env)
clone(process.env, shellEnv)
}
}
}
@@ -96,7 +107,7 @@ function replace (env) {
return
}
process.env = env
clone(process.env, env)
}
export default { getFromShell, needsPatching, normalize, replace }