Skip to content
Myr

Fix `killSignal` option (#93)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kevin Mårtensson · committed by Sindre Sorhus · parent 3534037 · Browse files · 2 files+7 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+7 added−1 removed

  • other:+7 added−1 removed

2 files+7 added−1 removed

modified:index.js+1 added-1 removed
155 unmodified lines
156 if (parsed.opts.timeout > 0) {157 timeoutId = setTimeout(() => {158 timeoutId = null;159 timedOut = true;160 spawned.kill(parsed.killSignal);160 spawned.kill(parsed.opts.killSignal);161 }, parsed.opts.timeout);162 }163164 const processDone = new Promise(resolve => {
140 unmodified lines
modified:test.js+6 added
282 unmodified lines
283 const err = await t.throws(cp);284285 t.is(err.signal, 'SIGTERM');286 });287288 test('custom err.signal', async t => {289 const err = await t.throws(m('delay', ['3000', '0'], {killSignal: 'SIGHUP', timeout: 1500}));290291 t.is(err.signal, 'SIGHUP');292 });293}294295test('result.signal is null for successful execution', async t => {296 t.is((await m('noop')).signal, null);
124 unmodified lines