-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: patch
script
package to use cross-spawn
Link to PR with this commit: testdouble/scripty#100
- Loading branch information
Showing
5 changed files
with
54 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
diff --git a/lib/run/spawn-script.js b/lib/run/spawn-script.js | ||
index b05fcb8dea26b0612e3db90506f0df7460e9cf33..3222ec591ea96bb7c7ed5536c6451fb0e79a934f 100644 | ||
--- a/lib/run/spawn-script.js | ||
+++ b/lib/run/spawn-script.js | ||
@@ -1,15 +1,19 @@ | ||
var _ = require('lodash') | ||
var printScript = require('./print-script') | ||
-var spawn = require('child_process').spawn | ||
+var spawn = require('cross-spawn').spawn | ||
|
||
module.exports = function (scriptFile, options, cb) { | ||
printScript(scriptFile) | ||
|
||
const child = spawn(scriptFile, options.userArgs, options.spawn) | ||
|
||
- child.on('close', code => cb(code !== 0 | ||
- ? new Error(`script failed: '${scriptFile}'\nexit status: ${code}`) | ||
- : null, code) | ||
+ child.on('close', (code) => | ||
+ cb( | ||
+ code !== 0 | ||
+ ? new Error(`script failed: '${scriptFile}'\nexit status: ${code}`) | ||
+ : null, | ||
+ code | ||
+ ) | ||
) | ||
|
||
_.invoke(options, 'spawn.tap', child) | ||
diff --git a/package.json b/package.json | ||
index fddbdf9ab092d3d2f898485bb74627a181878e4b..6d960822724e1526f10cf182ad9dd3d954dad649 100644 | ||
--- a/package.json | ||
+++ b/package.json | ||
@@ -34,6 +34,7 @@ | ||
"dependencies": { | ||
"async": "^2.6.4", | ||
"glob": "^7.0.3", | ||
+ "cross-spawn": "^7.0.6", | ||
"lodash": "^4.17.11", | ||
"resolve-pkg": "^1.0.0" | ||
}, |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.