-
Notifications
You must be signed in to change notification settings - Fork 3k
Do not redirect the env
command to set
, for windows bash shell
#19418
Conversation
Is there anything I can do to help this PR? |
env
command to set
, in Cygwin (Windows)
Hi @gucong3000, thank for your patience! While we don't officially support cygwin, I'm ok with taking patches for it that we can be confident won't cause other issues. In this case, I would suggest you add your Cygwin detection to |
lib/run-script.js
Outdated
@@ -138,7 +138,7 @@ function run (pkg, wd, cmd, args, cb) { | |||
if (cmd === 'test') { | |||
pkg.scripts.test = 'echo \'Error: no test specified\'' | |||
} else if (cmd === 'env') { | |||
if (process.platform === 'win32') { | |||
if (process.platform === 'win32' && !/^(msys|cygwin)$/.test(process.env.OSTYPE)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use lib/utils/is-windows-bash.js
and update that to include cygwin.
env
command to set
, in Cygwin (Windows)env
command to set
, for windows bash shell
@iarna Thanks for your patience. Modified. |
@@ -1,3 +1,4 @@ | |||
'use strict' | |||
var isWindows = require('./is-windows.js') | |||
module.exports = isWindows && /^MINGW(32|64)$/.test(process.env.MSYSTEM) | |||
var env = process.env | |||
module.exports = isWindows && (env.MSYSTEM ? /^MINGW(32|64)$/.test(env.MSYSTEM) : env.TERM === "cygwin") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The env.MSYSTEM guard here is unnecessary… but ah, I'll take and make a small change. =)
Credit: @gucong3000 PR-URL: npm/npm#19418 Reviewed-By: @iarna
Thanks! This is landing as 4c32413! |
env
only for window cmd shell%ProgramFiles%\Git\usr\bin\bash.exe
forlib/utils/is-windows-bash.js
#19419