Skip to content
Myr

Fix `error.timedOut` not working with `execa.sync()` (#249)

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

authored by ehmicky · committed by Sindre Sorhus · parent f5172cd · Browse files · 2 files+9 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+9 added−1 removed

  • other:+9 added−1 removed

2 files+9 added−1 removed

modified:index.js+1 added-1 removed
429 unmodified lines
430 const error = makeError(result, {431 code: result.status,432 joinedCommand,433 parsed,434 timedOut: false,434 timedOut: result.error && result.error.errno === 'ETIMEDOUT',435 isCanceled: false,436 killed: result.signal !== null437 });438
19 unmodified lines
modified:test.js+8 added
393 unmodified lines
394 t.false(killed);395 t.true(timedOut);396});397398test('timeout kills the process if it times out, in sync mode', async t => {399 const {killed, timedOut} = await t.throws(() => {400 execa.sync('forever', {timeout: 1, message: TIMEOUT_REGEXP});401 });402 t.false(killed);403 t.true(timedOut);404});405406test('timeout does not kill the process if it does not time out', async t => {407 const {timedOut} = await execa('delay', ['500'], {timeout: 1e8});408 t.false(timedOut);409});
265 unmodified lines