Improve validation and typing of signals (#1025)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by ehmicky · committed by GitHub · parent 9d7eed8 · Browse files · 16 files·+245 added−32 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
16 files+245 added−32 removed
- tests:+145 added−13 removed
- other:+100 added−19 removed
Provenance
- Commit
7213287- Tree
ddfe053- Author
ehmicky <ehmicky@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
9d7eed8
16 files changed+245 added−32 removed
modified:lib/arguments/options.js+2 added
1234567891013 unmodified lines24252627282930313254 unmodified linesimport {basename} from 'node:path';import process from 'node:process';import crossSpawn from 'cross-spawn';import {npmRunPathEnv} from 'npm-run-path';import {normalizeForceKillAfterDelay} from '../terminate/kill.js';import {normalizeKillSignal} from '../terminate/signal.js';import {validateTimeout} from '../terminate/timeout.js';import {handleNodeOption} from '../methods/node.js';import {validateEncoding, BINARY_ENCODINGS} from './encoding-option.js';import {normalizeCwd} from './cwd.js';13 unmodified lines validateTimeout(options); validateEncoding(options); options.shell = normalizeFileUrl(options.shell); options.env = getEnv(options); options.killSignal = normalizeKillSignal(options.killSignal); options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay); options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
if (process.platform === 'win32' && basename(file, '.exe') === 'cmd') {54 unmodified linesmodified:lib/terminate/kill.js+5 added-10 removed
1123456737 unmodified lines454647484950495051525354555657575859606114 unmodified lines76777879808180818284858687import os from 'node:os';import {setTimeout} from 'node:timers/promises';import {isErrorInstance} from '../return/final-error.js';import {normalizeSignalArgument} from './signal.js';
// Normalize the `forceKillAfterDelay` optionexport const normalizeForceKillAfterDelay = forceKillAfterDelay => { if (forceKillAfterDelay === false) {37 unmodified lines const [signal = killSignal, error] = isErrorInstance(signalOrError) ? [undefined, signalOrError] : [signalOrError, errorArgument];
if (typeof signal !== 'string' && typeof signal !== 'number') { throw new TypeError(`The first argument must be an error instance or a signal name string/number: ${signal}`); if (typeof signal !== 'string' && !Number.isInteger(signal)) { throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(signal)}`); }
if (error !== undefined && !isErrorInstance(error)) { throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${error}`); }
return {signal, error}; return {signal: normalizeSignalArgument(signal), error};};
// Fails right away when calling `subprocess.kill(error)`.// Does not wait for actual signal termination.14 unmodified lines kill('SIGKILL'); } catch {}};
const shouldForceKill = (signal, forceKillAfterDelay, killSignal, killResult) => normalizeSignal(signal) === normalizeSignal(killSignal)const shouldForceKill = (signal, forceKillAfterDelay, killSignal, killResult) => signal === killSignal && forceKillAfterDelay !== false && killResult;
const normalizeSignal = signal => typeof signal === 'string' ? os.constants.signals[signal.toUpperCase()] : signal;added:lib/terminate/signal.js+66 added
1+import {constants} from 'node:os';2+3+// Normalize signals for comparison purpose.4+// Also validate the signal exists.5+export const normalizeKillSignal = killSignal => {6+ const optionName = 'option `killSignal`';7+ if (killSignal === 0) {8+ throw new TypeError(`Invalid ${optionName}: 0 cannot be used.`);9+ }10+11+ return normalizeSignal(killSignal, optionName);12+};13+14+export const normalizeSignalArgument = signal => signal === 015+ ? signal16+ : normalizeSignal(signal, '`subprocess.kill()`\'s argument');17+18+const normalizeSignal = (signalNameOrInteger, optionName) => {19+ if (Number.isInteger(signalNameOrInteger)) {20+ return normalizeSignalInteger(signalNameOrInteger, optionName);21+ }22+23+ if (typeof signalNameOrInteger === 'string') {24+ return normalizeSignalName(signalNameOrInteger, optionName);25+ }26+27+ throw new TypeError(`Invalid ${optionName} ${String(signalNameOrInteger)}: it must be a string or an integer.\n${getAvailableSignals()}`);28+};29+30+const normalizeSignalInteger = (signalInteger, optionName) => {31+ if (signalsIntegerToName.has(signalInteger)) {32+ return signalsIntegerToName.get(signalInteger);33+ }34+35+ throw new TypeError(`Invalid ${optionName} ${signalInteger}: this signal integer does not exist.\n${getAvailableSignals()}`);36+};37+38+const getSignalsIntegerToName = () => new Map(Object.entries(constants.signals)39+ .reverse()40+ .map(([signalName, signalInteger]) => [signalInteger, signalName]));41+42+const signalsIntegerToName = getSignalsIntegerToName();43+44+const normalizeSignalName = (signalName, optionName) => {45+ if (signalName in constants.signals) {46+ return signalName;47+ }48+49+ if (signalName.toUpperCase() in constants.signals) {50+ throw new TypeError(`Invalid ${optionName} '${signalName}': please rename it to '${signalName.toUpperCase()}'.`);51+ }52+53+ throw new TypeError(`Invalid ${optionName} '${signalName}': this signal name does not exist.\n${getAvailableSignals()}`);54+};55+56+const getAvailableSignals = () => `Available signal names: ${getAvailableSignalNames()}.57+Available signal numbers: ${getAvailableSignalIntegers()}.`;58+59+const getAvailableSignalNames = () => Object.keys(constants.signals)60+ .sort()61+ .map(signalName => `'${signalName}'`)62+ .join(', ');63+64+const getAvailableSignalIntegers = () => [...new Set(Object.values(constants.signals)65+ .sort((signalInteger, signalIntegerTwo) => signalInteger - signalIntegerTwo))]66+ .join(', ');modified:test/helpers/early-error.js+4 added-2 removed
12334556789import {execa, execaSync} from '../../index.js';
export const earlyErrorOptions = {killSignal: false};export const earlyErrorOptions = {cancelSignal: false};export const getEarlyErrorSubprocess = options => execa('empty.js', {...earlyErrorOptions, ...options});export const earlyErrorOptionsSync = {maxBuffer: false};export const getEarlyErrorSubprocessSync = options => execaSync('empty.js', {...earlyErrorOptions, ...options});export const getEarlyErrorSubprocessSync = options => execaSync('empty.js', {...earlyErrorOptionsSync, ...options});
export const expectedEarlyError = {code: 'ERR_INVALID_ARG_TYPE'};export const expectedEarlyErrorSync = {code: 'ERR_OUT_OF_RANGE'};modified:test/io/max-buffer.js+4 added-6 removed
2 unmodified lines3 import getStream from 'get-stream';4 import {execa, execaSync} from '../../index.js';5 import {setFixtureDirectory} from '../helpers/fixtures-directory.js';6 import {fullStdio} from '../helpers/stdio.js';7-import {getEarlyErrorSubprocess, getEarlyErrorSubprocessSync} from '../helpers/early-error.js';7+import {getEarlyErrorSubprocess} from '../helpers/early-error.js';8 import {maxBuffer, assertErrorMessage} from '../helpers/max-buffer.js';9 10 setFixtureDirectory();11 247 unmodified lines259 test('abort stream when hitting maxBuffer with stdout', testMaxBufferAbort, 1);260 test('abort stream when hitting maxBuffer with stderr', testMaxBufferAbort, 2);261 test('abort stream when hitting maxBuffer with stdio[*]', testMaxBufferAbort, 3);262 263-const testEarlyError = async (t, getSubprocess) => {264- const {failed, isMaxBuffer} = await getSubprocess({reject: false, maxBuffer: 1});263+test('error.isMaxBuffer is false on early errors', async t => {264+ const {failed, isMaxBuffer} = await getEarlyErrorSubprocess({reject: false, maxBuffer: 1});265 t.true(failed);266 t.false(isMaxBuffer);267-};267+});268 269-test('error.isMaxBuffer is false on early errors', testEarlyError, getEarlyErrorSubprocess);270-test('error.isMaxBuffer is false on early errors, sync', testEarlyError, getEarlyErrorSubprocessSync);modified:test/return/early-error.js+2 added-1 removed
6 unmodified lines7 earlyErrorOptions,8 getEarlyErrorSubprocess,9 getEarlyErrorSubprocessSync,10 expectedEarlyError,11+ expectedEarlyErrorSync,12 } from '../helpers/early-error.js';13 14 setFixtureDirectory();15 27 unmodified lines43 t.true(failed);44 });45 46 test('child_process.spawnSync() early errors are propagated with a correct shape', t => {46- t.throws(getEarlyErrorSubprocessSync, expectedEarlyError);47+ t.throws(getEarlyErrorSubprocessSync, expectedEarlyErrorSync);48 });49 50 test('child_process.spawnSync() early errors are propagated with a correct shape - reject false', t => {51 const {failed} = getEarlyErrorSubprocessSync({reject: false});63 unmodified linesmodified:test/terminate/kill-force.js+2 added
88 unmodified lines89 test('`forceKillAfterDelay: true` should kill after a timeout', testForceKill, true);90 test('`forceKillAfterDelay: undefined` should kill after a timeout', testForceKill, undefined);91 test('`forceKillAfterDelay` should kill after a timeout with SIGTERM', testForceKill, 50, 'SIGTERM');92 test('`forceKillAfterDelay` should kill after a timeout with the killSignal string', testForceKill, 50, 'SIGINT', {killSignal: 'SIGINT'});93+ test('`forceKillAfterDelay` should kill after a timeout with the killSignal string, mixed', testForceKill, 50, 'SIGINT', {killSignal: constants.signals.SIGINT});94 test('`forceKillAfterDelay` should kill after a timeout with the killSignal number', testForceKill, 50, constants.signals.SIGINT, {killSignal: constants.signals.SIGINT});95+ test('`forceKillAfterDelay` should kill after a timeout with the killSignal number, mixed', testForceKill, 50, constants.signals.SIGINT, {killSignal: 'SIGINT'});96 test('`forceKillAfterDelay` should kill after a timeout with an error', testForceKill, 50, new Error('test'));97 test('`forceKillAfterDelay` should kill after a timeout with an error and a killSignal', testForceKill, 50, new Error('test'), {killSignal: 'SIGINT'});98 99 test('`forceKillAfterDelay` works with the "signal" option', async t => {43 unmodified linesmodified:test/terminate/kill-signal.js+46 added-4 removed
1 import {once} from 'node:events';2 import {platform, version} from 'node:process';3+import {constants} from 'node:os';4 import {setImmediate} from 'node:timers/promises';5 import test from 'ava';5-import {execa} from '../../index.js';6+import {execa, execaSync} from '../../index.js';7 import {setFixtureDirectory} from '../helpers/fixtures-directory.js';8 9 setFixtureDirectory();10 11 const isWindows = platform === 'win32';12 const majorNodeVersion = Number(version.split('.')[0].slice(1));13 14+const testKillSignal = async (t, killSignal) => {15+ const {isTerminated, signal} = await t.throwsAsync(execa('forever.js', {killSignal, timeout: 1}));16+ t.true(isTerminated);17+ t.is(signal, 'SIGINT');18+};19+20+test('Can use killSignal: "SIGINT"', testKillSignal, 'SIGINT');21+test('Can use killSignal: 2', testKillSignal, constants.signals.SIGINT);22+23+const testKillSignalSync = (t, killSignal) => {24+ const {isTerminated, signal} = t.throws(() => {25+ execaSync('forever.js', {killSignal, timeout: 1});26+ });27+ t.true(isTerminated);28+ t.is(signal, 'SIGINT');29+};30+31+test('Can use killSignal: "SIGINT", sync', testKillSignalSync, 'SIGINT');32+test('Can use killSignal: 2, sync', testKillSignalSync, constants.signals.SIGINT);33+34+test('Can call .kill("SIGTERM")', async t => {35+ const subprocess = execa('forever.js');36+ subprocess.kill('SIGTERM');37+ const {isTerminated, signal} = await t.throwsAsync(subprocess);38+ t.true(isTerminated);39+ t.is(signal, 'SIGTERM');40+});41+42+test('Can call .kill(15)', async t => {43+ const subprocess = execa('forever.js');44+ subprocess.kill(constants.signals.SIGTERM);45+ const {isTerminated, signal} = await t.throwsAsync(subprocess);46+ t.true(isTerminated);47+ t.is(signal, 'SIGTERM');48+});49+50+test('Can call .kill(0)', async t => {51+ const subprocess = execa('forever.js');52+ t.true(subprocess.kill(0));53+ subprocess.kill();54+ await t.throwsAsync(subprocess);55+ t.false(subprocess.kill(0));56+});57+58 test('Can call `.kill()` multiple times', async t => {59 const subprocess = execa('forever.js');60 subprocess.kill();61 subprocess.kill();32 unmodified lines94 }, {message});95 await subprocess;96 };97 53-test('Cannot call .kill(null)', testInvalidKillArgument, null);54-test('Cannot call .kill(0n)', testInvalidKillArgument, 0n);55-test('Cannot call .kill(true)', testInvalidKillArgument, true);98 test('Cannot call .kill(errorObject)', testInvalidKillArgument, {name: '', message: '', stack: ''});99 test('Cannot call .kill(errorArray)', testInvalidKillArgument, [new Error('test')]);100 test('Cannot call .kill(undefined, true)', testInvalidKillArgument, undefined, true);101 test('Cannot call .kill("SIGTERM", true)', testInvalidKillArgument, 'SIGTERM', true);53 unmodified linesadded:test/terminate/signal.js+87 added
1+import test from 'ava';2+import {execa, execaSync} from '../../index.js';3+import {setFixtureDirectory} from '../helpers/fixtures-directory.js';4+5+setFixtureDirectory();6+7+const VALIDATION_MESSAGES = {8+ string: 'this signal name does not exist',9+ integer: 'this signal integer does not exist',10+ other: 'it must be a string or an integer',11+ rename: 'please rename it to',12+ zero: '0 cannot be used',13+};14+15+const validateMessage = (t, message, type) => {16+ t.true(message.includes(VALIDATION_MESSAGES[type]));17+18+ if (type !== 'rename' && type !== 'zero') {19+ t.true(message.includes('Available signal names: \'SIGABRT\', '));20+ t.true(message.includes('Available signal numbers: 1, '));21+ }22+};23+24+const testInvalidKillSignal = (t, killSignal, type, execaMethod) => {25+ const {message} = t.throws(() => {26+ execaMethod('empty.js', {killSignal});27+ });28+ t.true(message.includes('Invalid option `killSignal`'));29+ validateMessage(t, message, type);30+};31+32+test('Cannot use killSignal: "SIGOTHER"', testInvalidKillSignal, 'SIGOTHER', 'string', execa);33+test('Cannot use killSignal: "Sigterm"', testInvalidKillSignal, 'Sigterm', 'rename', execa);34+test('Cannot use killSignal: "sigterm"', testInvalidKillSignal, 'sigterm', 'rename', execa);35+test('Cannot use killSignal: -1', testInvalidKillSignal, -1, 'integer', execa);36+test('Cannot use killSignal: 200', testInvalidKillSignal, 200, 'integer', execa);37+test('Cannot use killSignal: 1n', testInvalidKillSignal, 1n, 'other', execa);38+test('Cannot use killSignal: 1.5', testInvalidKillSignal, 1.5, 'other', execa);39+test('Cannot use killSignal: Infinity', testInvalidKillSignal, Number.POSITIVE_INFINITY, 'other', execa);40+test('Cannot use killSignal: NaN', testInvalidKillSignal, Number.NaN, 'other', execa);41+test('Cannot use killSignal: false', testInvalidKillSignal, false, 'other', execa);42+test('Cannot use killSignal: null', testInvalidKillSignal, null, 'other', execa);43+test('Cannot use killSignal: symbol', testInvalidKillSignal, Symbol('test'), 'other', execa);44+test('Cannot use killSignal: {}', testInvalidKillSignal, {}, 'other', execa);45+test('Cannot use killSignal: 0', testInvalidKillSignal, 0, 'zero', execa);46+test('Cannot use killSignal: "SIGOTHER", sync', testInvalidKillSignal, 'SIGOTHER', 'string', execaSync);47+test('Cannot use killSignal: "Sigterm", sync', testInvalidKillSignal, 'Sigterm', 'rename', execaSync);48+test('Cannot use killSignal: "sigterm", sync', testInvalidKillSignal, 'sigterm', 'rename', execaSync);49+test('Cannot use killSignal: -1, sync', testInvalidKillSignal, -1, 'integer', execaSync);50+test('Cannot use killSignal: 200, sync', testInvalidKillSignal, 200, 'integer', execaSync);51+test('Cannot use killSignal: 1.5, sync', testInvalidKillSignal, 1.5, 'other', execaSync);52+test('Cannot use killSignal: Infinity, sync', testInvalidKillSignal, Number.POSITIVE_INFINITY, 'other', execaSync);53+test('Cannot use killSignal: NaN, sync', testInvalidKillSignal, Number.NaN, 'other', execaSync);54+test('Cannot use killSignal: null, sync', testInvalidKillSignal, null, 'other', execaSync);55+test('Cannot use killSignal: symbol, sync', testInvalidKillSignal, Symbol('test'), 'other', execaSync);56+test('Cannot use killSignal: {}, sync', testInvalidKillSignal, {}, 'other', execaSync);57+test('Cannot use killSignal: 0, sync', testInvalidKillSignal, 0, 'zero', execaSync);58+59+const testInvalidSignalArgument = async (t, signal, type) => {60+ const subprocess = execa('empty.js');61+ const {message} = t.throws(() => {62+ subprocess.kill(signal);63+ });64+65+ if (type === 'other') {66+ t.true(message.includes('must be an error instance or a signal name string/integer'));67+ } else {68+ t.true(message.includes('Invalid `subprocess.kill()`\'s argument'));69+ validateMessage(t, message, type);70+ }71+72+ await subprocess;73+};74+75+test('Cannot use subprocess.kill("SIGOTHER")', testInvalidSignalArgument, 'SIGOTHER', 'string');76+test('Cannot use subprocess.kill("Sigterm")', testInvalidSignalArgument, 'Sigterm', 'rename');77+test('Cannot use subprocess.kill("sigterm")', testInvalidSignalArgument, 'sigterm', 'rename');78+test('Cannot use subprocess.kill(-1)', testInvalidSignalArgument, -1, 'integer');79+test('Cannot use subprocess.kill(200)', testInvalidSignalArgument, 200, 'integer');80+test('Cannot use subprocess.kill(1n)', testInvalidSignalArgument, 1n, 'other');81+test('Cannot use subprocess.kill(1.5)', testInvalidSignalArgument, 1.5, 'other');82+test('Cannot use subprocess.kill(Infinity)', testInvalidSignalArgument, Number.POSITIVE_INFINITY, 'other');83+test('Cannot use subprocess.kill(NaN)', testInvalidSignalArgument, Number.NaN, 'other');84+test('Cannot use subprocess.kill(false)', testInvalidSignalArgument, false, 'other');85+test('Cannot use subprocess.kill(null)', testInvalidSignalArgument, null, 'other');86+test('Cannot use subprocess.kill(symbol)', testInvalidSignalArgument, Symbol('test'), 'other');87+test('Cannot use subprocess.kill({})', testInvalidSignalArgument, {}, 'other');modified:test-d/arguments/options.test-d.ts+12 added
133 unmodified lines134 await execa('unicorns', {killSignal: 9});135 execaSync('unicorns', {killSignal: 9});136 expectError(await execa('unicorns', {killSignal: false}));137 expectError(execaSync('unicorns', {killSignal: false}));138+expectError(await execa('unicorns', {killSignal: 'Sigterm'}));139+expectError(execaSync('unicorns', {killSignal: 'Sigterm'}));140+expectError(await execa('unicorns', {killSignal: 'sigterm'}));141+expectError(execaSync('unicorns', {killSignal: 'sigterm'}));142+expectError(await execa('unicorns', {killSignal: 'SIGOTHER'}));143+expectError(execaSync('unicorns', {killSignal: 'SIGOTHER'}));144+expectError(await execa('unicorns', {killSignal: 'SIGEMT'}));145+expectError(execaSync('unicorns', {killSignal: 'SIGEMT'}));146+expectError(await execa('unicorns', {killSignal: 'SIGCLD'}));147+expectError(execaSync('unicorns', {killSignal: 'SIGCLD'}));148+expectError(await execa('unicorns', {killSignal: 'SIGRT1'}));149+expectError(execaSync('unicorns', {killSignal: 'SIGRT1'}));150 151 await execa('unicorns', {forceKillAfterDelay: false});152 expectError(execaSync('unicorns', {forceKillAfterDelay: false}));153 await execa('unicorns', {forceKillAfterDelay: 42});59 unmodified linesmodified:test-d/return/result-main.test-d.ts+4 added-4 removed
26 unmodified lines27 expectType<boolean>(unicornsResult.timedOut);28 expectType<boolean>(unicornsResult.isCanceled);29 expectType<boolean>(unicornsResult.isTerminated);30 expectType<boolean>(unicornsResult.isMaxBuffer);31-expectType<string | undefined>(unicornsResult.signal);31+expectType<NodeJS.Signals | undefined>(unicornsResult.signal);32 expectType<string | undefined>(unicornsResult.signalDescription);33 expectType<string>(unicornsResult.cwd);34 expectType<number>(unicornsResult.durationMs);35 expectType<Result[]>(unicornsResult.pipedFrom);7 unmodified lines43 expectType<boolean>(unicornsResultSync.timedOut);44 expectType<boolean>(unicornsResultSync.isCanceled);45 expectType<boolean>(unicornsResultSync.isTerminated);46 expectType<boolean>(unicornsResultSync.isMaxBuffer);47-expectType<string | undefined>(unicornsResultSync.signal);47+expectType<NodeJS.Signals | undefined>(unicornsResultSync.signal);48 expectType<string | undefined>(unicornsResultSync.signalDescription);49 expectType<string>(unicornsResultSync.cwd);50 expectType<number>(unicornsResultSync.durationMs);51 expectType<[]>(unicornsResultSync.pipedFrom);8 unmodified lines60 expectType<boolean>(error.timedOut);61 expectType<boolean>(error.isCanceled);62 expectType<boolean>(error.isTerminated);63 expectType<boolean>(error.isMaxBuffer);64- expectType<string | undefined>(error.signal);64+ expectType<NodeJS.Signals | undefined>(error.signal);65 expectType<string | undefined>(error.signalDescription);66 expectType<string>(error.cwd);67 expectType<number>(error.durationMs);68 expectType<string>(error.shortMessage);13 unmodified lines82 expectType<boolean>(errorSync.timedOut);83 expectType<boolean>(errorSync.isCanceled);84 expectType<boolean>(errorSync.isTerminated);85 expectType<boolean>(errorSync.isMaxBuffer);86- expectType<string | undefined>(errorSync.signal);86+ expectType<NodeJS.Signals | undefined>(errorSync.signal);87 expectType<string | undefined>(errorSync.signalDescription);88 expectType<string>(errorSync.cwd);89 expectType<number>(errorSync.durationMs);90 expectType<string>(errorSync.shortMessage);5 unmodified linesmodified:test-d/subprocess/subprocess.test-d.ts+6 added
12 unmodified lines13 subprocess.kill('SIGKILL', new Error('test'));14 subprocess.kill(undefined, new Error('test'));15 expectError(subprocess.kill(null));16 expectError(subprocess.kill(0n));17+expectError(subprocess.kill('Sigkill'));18+expectError(subprocess.kill('sigkill'));19+expectError(subprocess.kill('SIGOTHER'));20+expectError(subprocess.kill('SIGEMT'));21+expectError(subprocess.kill('SIGCLD'));22+expectError(subprocess.kill('SIGRT1'));23 expectError(subprocess.kill([new Error('test')]));24 expectError(subprocess.kill({message: 'test'}));25 expectError(subprocess.kill(undefined, {}));26 expectError(subprocess.kill('SIGKILL', {}));14 unmodified linesmodified:types/arguments/options.d.ts+1 added-1 removed
276 unmodified lines277 This can be either a name (like `'SIGTERM'`) or a number (like `9`).278 279 @default 'SIGTERM'280 */281- readonly killSignal?: string | number;281+ readonly killSignal?: NodeJS.Signals | number;282 283 /**284 Run the subprocess independently from the current process.285 85 unmodified linesmodified:types/return/result.d.ts+1 added-1 removed
115 unmodified lines116 - Another process. This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).117 118 If a signal terminated the subprocess, this property is defined and included in the error message. Otherwise it is `undefined`.119 */120- signal?: string;120+ signal?: NodeJS.Signals;121 122 /**123 A human-friendly description of the signal that was used to terminate the subprocess.124 65 unmodified linesmodified:types/subprocess/subprocess.d.ts+2 added-2 removed
84 unmodified lines85 When an error is passed as argument, it is set to the subprocess' `error.cause`. The subprocess is then terminated with the default signal. This does not emit the [`error` event](https://nodejs.org/api/child_process.html#event-error).86 87 [More info.](https://nodejs.org/api/child_process.html#subprocesskillsignal)88 */89- kill(signal: Parameters<ChildProcess['kill']>[0], error?: Error): ReturnType<ChildProcess['kill']>;90- kill(error?: Error): ReturnType<ChildProcess['kill']>;89+ kill(signal?: NodeJS.Signals | number, error?: Error): boolean;90+ kill(error?: Error): boolean;91 92 /**93 Subprocesses are [async iterables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator). They iterate over each output line.94 */38 unmodified linesmodified:package.json+1 added-1 removed
50 unmodified lines51 "@sindresorhus/merge-streams": "^4.0.0",52 "cross-spawn": "^7.0.3",53 "figures": "^6.1.0",54 "get-stream": "^9.0.0",55- "human-signals": "^6.0.0",55+ "human-signals": "^7.0.0",56 "is-plain-obj": "^4.1.0",57 "is-stream": "^4.0.1",58 "npm-run-path": "^5.2.0",59 "pretty-ms": "^9.0.0",41 unmodified lines