diff --git a/node_modules/@npmcli/run-script/lib/run-script-pkg.js b/node_modules/@npmcli/run-script/lib/run-script-pkg.js index 5980376f558f4..47f386304e459 100644 --- a/node_modules/@npmcli/run-script/lib/run-script-pkg.js +++ b/node_modules/@npmcli/run-script/lib/run-script-pkg.js @@ -20,6 +20,9 @@ const runScriptPkg = async options => { stdioString = false, // note: only used when stdio:inherit banner = true, + // how long to wait for a process.kill signal + // only exposed here so that we can make the test go a bit faster. + signalTimeout = 500, } = options const {scripts = {}, gypfile} = pkg @@ -68,7 +71,17 @@ const runScriptPkg = async options => { if (p.stdin) p.stdin.end() - return p + return p.catch(er => { + const { signal } = er + if (stdio === 'inherit' && signal) { + process.kill(process.pid, signal) + // just in case we don't die, reject after 500ms + // this also keeps the node process open long enough to actually + // get the signal, rather than terminating gracefully. + return new Promise((res, rej) => setTimeout(() => rej(er), signalTimeout)) + } else + throw er + }) } module.exports = runScriptPkg diff --git a/node_modules/@npmcli/run-script/lib/run-script.js b/node_modules/@npmcli/run-script/lib/run-script.js index 3be39b0ba8076..af33d2113f9ef 100644 --- a/node_modules/@npmcli/run-script/lib/run-script.js +++ b/node_modules/@npmcli/run-script/lib/run-script.js @@ -1,6 +1,7 @@ const rpj = require('read-package-json-fast') const runScriptPkg = require('./run-script-pkg.js') const validateOptions = require('./validate-options.js') +const isServerPackage = require('./is-server-package.js') const runScript = options => { validateOptions(options) @@ -9,4 +10,4 @@ const runScript = options => { : rpj(path + '/package.json').then(pkg => runScriptPkg({...options, pkg})) } -module.exports = runScript +module.exports = Object.assign(runScript, { isServerPackage }) diff --git a/node_modules/@npmcli/run-script/package.json b/node_modules/@npmcli/run-script/package.json index 5ec3bb5b66876..c8a052f036763 100644 --- a/node_modules/@npmcli/run-script/package.json +++ b/node_modules/@npmcli/run-script/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/run-script", - "version": "1.7.4", + "version": "1.7.5", "description": "Run a lifecycle script for a package (descendant of npm-lifecycle)", "author": "Isaac Z. Schlueter (https://izs.me)", "license": "ISC", diff --git a/package-lock.json b/package-lock.json index cd6d96b687059..f0617ffe2b13a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -81,7 +81,7 @@ "@npmcli/arborist": "^1.0.8", "@npmcli/ci-detect": "^1.2.0", "@npmcli/config": "^1.2.1", - "@npmcli/run-script": "^1.7.4", + "@npmcli/run-script": "^1.7.5", "abbrev": "~1.1.1", "ansicolors": "~0.3.2", "ansistyles": "~0.1.3", @@ -524,9 +524,9 @@ } }, "node_modules/@npmcli/run-script": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-1.7.4.tgz", - "integrity": "sha512-GAeOB6P4/aYyvEbROVHXuSGPgy4wwQN/fGfXP993o9btyuCAOaz0T2cr5Y1y4nSeaBPfhk5W/E/AfFKDt6yG7w==", + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-1.7.5.tgz", + "integrity": "sha512-G8taZCc0HExiLadB3Nv0/h1TWjQ9HhkqW/waaH9MNqMX26rPRyNORst1LlNXOO8QnxQF4tNdJfc/Z3TuEtiyww==", "inBundle": true, "dependencies": { "@npmcli/node-gyp": "^1.0.0", @@ -9168,9 +9168,9 @@ } }, "@npmcli/run-script": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-1.7.4.tgz", - "integrity": "sha512-GAeOB6P4/aYyvEbROVHXuSGPgy4wwQN/fGfXP993o9btyuCAOaz0T2cr5Y1y4nSeaBPfhk5W/E/AfFKDt6yG7w==", + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-1.7.5.tgz", + "integrity": "sha512-G8taZCc0HExiLadB3Nv0/h1TWjQ9HhkqW/waaH9MNqMX26rPRyNORst1LlNXOO8QnxQF4tNdJfc/Z3TuEtiyww==", "requires": { "@npmcli/node-gyp": "^1.0.0", "@npmcli/promise-spawn": "^1.3.0", diff --git a/package.json b/package.json index d0ca0bf91a7dd..1c8461587b4c4 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@npmcli/arborist": "^1.0.8", "@npmcli/ci-detect": "^1.2.0", "@npmcli/config": "^1.2.1", - "@npmcli/run-script": "^1.7.4", + "@npmcli/run-script": "^1.7.5", "abbrev": "~1.1.1", "ansicolors": "~0.3.2", "ansistyles": "~0.1.3",