Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
run-script: Do not use SET to fetch the env in git-bash or cygwin
Browse files Browse the repository at this point in the history
Credit: @gucong3000
PR-URL: #19418
Reviewed-By: @iarna
  • Loading branch information
gucong3000 authored and iarna committed Jul 10, 2018
1 parent 7984206 commit 4c32413
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/run-script.js
Expand Up @@ -9,6 +9,7 @@ var chain = require('slide').chain
var usage = require('./utils/usage')
var output = require('./utils/output.js')
var didYouMean = require('./utils/did-you-mean')
var isWindowsShell = require('./utils/is-windows-shell.js')

runScript.usage = usage(
'run-script',
Expand Down Expand Up @@ -139,7 +140,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 (isWindowsShell) {
log.verbose('run-script using default platform env: SET (Windows)')
pkg.scripts[cmd] = 'SET'
} else {
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/is-windows-bash.js
@@ -1,3 +1,4 @@
'use strict'
var isWindows = require('./is-windows.js')
module.exports = isWindows && /^MINGW(32|64)$/.test(process.env.MSYSTEM)
module.exports = isWindows &&
(/^MINGW(32|64)$/.test(process.env.MSYSTEM) || process.env.TERM === "cygwin")

0 comments on commit 4c32413

Please sign in to comment.