Skip to content

Commit

Permalink
Do not allow stdin: 0 combined with stdio
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Jun 19, 2019
1 parent ab83d8d commit dca749d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/stdio.js
@@ -1,7 +1,7 @@
'use strict';
const aliases = ['stdin', 'stdout', 'stderr'];

const hasAlias = opts => aliases.some(alias => Boolean(opts[alias]));
const hasAlias = opts => alias.some(alias => opts[alias] !== undefined);

const stdio = opts => {
if (!opts) {
Expand Down
1 change: 1 addition & 0 deletions test/stdio.js
Expand Up @@ -45,6 +45,7 @@ test(stdioMacro, {stdio: {foo: 'bar'}}, new TypeError('Expected `stdio` to be of
test(stdioMacro, {stdin: 'inherit', stdio: 'pipe'}, new Error('It\'s not possible to provide `stdio` in combination with one of `stdin`, `stdout`, `stderr`'));
test(stdioMacro, {stdin: 'inherit', stdio: ['pipe']}, new Error('It\'s not possible to provide `stdio` in combination with one of `stdin`, `stdout`, `stderr`'));
test(stdioMacro, {stdin: 'inherit', stdio: [undefined, 'pipe']}, new Error('It\'s not possible to provide `stdio` in combination with one of `stdin`, `stdout`, `stderr`'));
test(stdioMacro, {stdin: 0, stdio: 'pipe'}, new Error('It\'s not possible to provide `stdio` in combination with one of `stdin`, `stdout`, `stderr`'));

const forkMacro = (...args) => macro(...args, stdio.node);
forkMacro.title = macroTitle('execa.fork()');
Expand Down

0 comments on commit dca749d

Please sign in to comment.