Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Jun 17, 2019
1 parent 05d2da7 commit 3d2622c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Expand Up @@ -285,10 +285,10 @@ function getForceKillAfterTimeout({forceKillAfterTimeout = true}) {
return forceKillAfterTimeout;
}

function handleSpawned(spawned) {
function handleSpawned(spawned, context) {
return new Promise((resolve, reject) => {
spawned.on('exit', (code, signal) => {
if (spawned.timedOut) {
if (context.timedOut) {
return reject(Object.assign(new Error('Timed out'), {code, signal}));
}

Expand Down Expand Up @@ -362,7 +362,7 @@ const execa = (file, args, options) => {
}

// TODO: Use native "finally" syntax when targeting Node.js 10
const processDone = pFinally(handleSpawned(spawned), cleanup);
const processDone = pFinally(handleSpawned(spawned, context), cleanup);

const handlePromise = async () => {
const stdoutPromise = getStreamPromise(spawned.stdout, {encoding, buffer, maxBuffer});
Expand Down

0 comments on commit 3d2622c

Please sign in to comment.