Skip to content

Commit

Permalink
Fix errors being thrown when detached: true or cleanup: false is …
Browse files Browse the repository at this point in the history
…used
  • Loading branch information
ehmicky committed Aug 9, 2019
1 parent 56b749d commit cc7b829
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/kill.js
Expand Up @@ -85,7 +85,7 @@ const setupTimeout = (spawned, {timeout, killSignal = 'SIGTERM'}, spawnedPromise
// `cleanup` option handling
const setExitHandler = (spawned, {cleanup, detached}, timedPromise) => {
if (!cleanup || detached) {
return;
return timedPromise;
}

const removeExitHandler = onExit(() => {
Expand Down
12 changes: 11 additions & 1 deletion test/fixtures/sub-process-exit
Expand Up @@ -4,4 +4,14 @@ const execa = require('../..');

const cleanup = process.argv[2] === 'true';
const detached = process.argv[3] === 'true';
execa('node', ['./test/fixtures/noop'], {cleanup, detached});

const runChild = async () => {
try {
await execa('node', ['./test/fixtures/noop'], {cleanup, detached});
} catch (error) {
console.error(error);
process.exit(1);
}
};

runChild();

0 comments on commit cc7b829

Please sign in to comment.