Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ function handleArgs(command, args, options = {}) {
}

function handleInput(spawned, input) {
if (input === undefined) {
// Checking for stdin is workaround for https://github.com/nodejs/node/issues/26852 on Node.js 10 and 12
if (input === undefined || spawned.stdin === undefined) {
return;
}

Expand Down
4 changes: 4 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ if (process.platform !== 'win32') {
const cp = execa('non-executable');
await t.throwsAsync(cp);
});

test('execa() rejects with correct error and doesn\'t throw if running non-executable with input', async t => {
await t.throwsAsync(execa('non-executable', {input: 'Hey!'}), /EACCES/);
});
}

test('error.killed is true if process was killed directly', async t => {
Expand Down