Skip to content
Myr

Fix non-executable execution with `input` option (#212)

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

authored by Yanis Benson · committed by Sindre Sorhus · parent 075faf3 · Browse files · 2 files+6 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+6 added−1 removed

  • other:+6 added−1 removed

2 files+6 added−1 removed

modified:index.js+2 added-1 removed
105 unmodified lines
106 return {command, args, options, parsed};107}108109function handleInput(spawned, input) {110 if (input === undefined) {110 // Checking for stdin is workaround for https://github.com/nodejs/node/issues/26852 on Node.js 10 and 12111 if (input === undefined || spawned.stdin === undefined) {112 return;113 }114115 if (isStream(input)) {
384 unmodified lines
modified:test.js+4 added
334 unmodified lines
335 test('execa() rejects if running non-executable', async t => {336 const cp = execa('non-executable');337 await t.throwsAsync(cp);338 });339340 test('execa() rejects with correct error and doesn\'t throw if running non-executable with input', async t => {341 await t.throwsAsync(execa('non-executable', {input: 'Hey!'}), /EACCES/);342 });343}344345test('error.killed is true if process was killed directly', async t => {346 const cp = execa('forever');
352 unmodified lines