Skip to content

Commit

Permalink
Merge 69a8550 into 56b749d
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Aug 9, 2019
2 parents 56b749d + 69a8550 commit 6c30a33
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/kill.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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();
6 changes: 3 additions & 3 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ test('stripFinalNewline in sync mode on failure', t => {
});

test('preferLocal: true', async t => {
await t.notThrowsAsync(execa('ava', ['--version'], {preferLocal: true, env: {PATH: ''}}));
await t.notThrowsAsync(execa('ava', ['--version'], {preferLocal: true, env: {Path: '', PATH: ''}}));
});

test('preferLocal: false', async t => {
await t.throwsAsync(execa('ava', ['--version'], {preferLocal: false, env: {PATH: ''}}), ENOENT_REGEXP);
await t.throwsAsync(execa('ava', ['--version'], {preferLocal: false, env: {Path: '', PATH: ''}}), ENOENT_REGEXP);
});

test('preferLocal: undefined', async t => {
await t.throwsAsync(execa('ava', ['--version'], {env: {PATH: ''}}), ENOENT_REGEXP);
await t.throwsAsync(execa('ava', ['--version'], {env: {Path: '', PATH: ''}}), ENOENT_REGEXP);
});

test('localDir option', async t => {
Expand Down

0 comments on commit 6c30a33

Please sign in to comment.