From b612b4c2c6a13167d97608b9e9f958789328df07 Mon Sep 17 00:00:00 2001 From: Vishakha Sawant Date: Thu, 17 Jun 2021 18:39:36 +0530 Subject: [PATCH 1/3] use cross_spawn --- lib/run/spawn-script.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/run/spawn-script.js b/lib/run/spawn-script.js index b05fcb8..08ff23b 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) From 850088edc6dbaab7a5f3695fa91028923c83842b Mon Sep 17 00:00:00 2001 From: Vishakha Sawant Date: Mon, 21 Jun 2021 10:55:12 +0530 Subject: [PATCH 2/3] update package name --- lib/run/spawn-script.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/run/spawn-script.js b/lib/run/spawn-script.js index 08ff23b..25530fc 100644 --- a/lib/run/spawn-script.js +++ b/lib/run/spawn-script.js @@ -1,20 +1,20 @@ -var _ = require('lodash') -var printScript = require('./print-script') -var spawn = require('cross_spawn').spawn +var _ = require("lodash"); +var printScript = require("./print-script"); +var spawn = require("cross-spawn").spawn; module.exports = function (scriptFile, options, cb) { - printScript(scriptFile) + printScript(scriptFile); - const child = spawn(scriptFile, options.userArgs, options.spawn) + const child = spawn(scriptFile, options.userArgs, options.spawn); - child.on('close', (code) => + child.on("close", (code) => cb( code !== 0 ? new Error(`script failed: '${scriptFile}'\nexit status: ${code}`) : null, code ) - ) + ); - _.invoke(options, 'spawn.tap', child) -} + _.invoke(options, "spawn.tap", child); +}; From f5a9111bda713a8594ffb51f24b7aed5336e57d7 Mon Sep 17 00:00:00 2001 From: Vishakha Sawant Date: Mon, 21 Jun 2021 11:56:08 +0530 Subject: [PATCH 3/3] remove formatting --- lib/run/spawn-script.js | 18 ++++----- package-lock.json | 87 +++++++++++++++++++++++++++++------------ package.json | 1 + 3 files changed, 73 insertions(+), 33 deletions(-) diff --git a/lib/run/spawn-script.js b/lib/run/spawn-script.js index 25530fc..3222ec5 100644 --- a/lib/run/spawn-script.js +++ b/lib/run/spawn-script.js @@ -1,20 +1,20 @@ -var _ = require("lodash"); -var printScript = require("./print-script"); -var spawn = require("cross-spawn").spawn; +var _ = require('lodash') +var printScript = require('./print-script') +var spawn = require('cross-spawn').spawn module.exports = function (scriptFile, options, cb) { - printScript(scriptFile); + printScript(scriptFile) - const child = spawn(scriptFile, options.userArgs, options.spawn); + const child = spawn(scriptFile, options.userArgs, options.spawn) - child.on("close", (code) => + child.on('close', (code) => cb( code !== 0 ? new Error(`script failed: '${scriptFile}'\nexit status: ${code}`) : null, code ) - ); + ) - _.invoke(options, "spawn.tap", child); -}; + _.invoke(options, 'spawn.tap', child) +} diff --git a/package-lock.json b/package-lock.json index d6f8404..f1f4eac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -354,16 +354,23 @@ "dev": true }, "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "dependencies": { + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + } } }, "d": { @@ -616,6 +623,42 @@ "strip-json-comments": "^2.0.1", "table": "^4.0.3", "text-table": "^0.2.0" + }, + "dependencies": { + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + } } }, "eslint-config-standard": { @@ -1388,8 +1431,7 @@ "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" }, "isstream": { "version": "0.1.2", @@ -1887,10 +1929,9 @@ "dev": true }, "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" }, "path-parse": { "version": "1.0.6", @@ -2241,19 +2282,17 @@ "dev": true }, "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "requires": { - "shebang-regex": "^1.0.0" + "shebang-regex": "^3.0.0" } }, "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" }, "signal-exit": { "version": "3.0.2", diff --git a/package.json b/package.json index c3d7691..a873ec0 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ }, "dependencies": { "async": "^2.6.1", + "cross-spawn": "^7.0.3", "glob": "^7.0.3", "lodash": "^4.17.11", "resolve-pkg": "^1.0.0"