Skip to content

Commit

Permalink
Remove faulty emulated ENOENT error on Windows (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
mterrel committed Dec 3, 2020
1 parent 2706b3f commit bdbd975
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 0 additions & 2 deletions index.js
Expand Up @@ -147,8 +147,6 @@ const execa = (file, args, options) => {

const handlePromiseOnce = onetime(handlePromise);

crossSpawn._enoent.hookChildProcess(spawned, parsed.parsed);

handleInput(spawned, parsed.options.input);

spawned.all = makeAllStream(spawned, parsed.options);
Expand Down
8 changes: 4 additions & 4 deletions test/error.js
Expand Up @@ -73,8 +73,8 @@ test('error.shortMessage does not contain stdout/stderr', async t => {
});

test('Original error.message is kept', async t => {
const {originalMessage} = await t.throwsAsync(execa('wrong command'));
t.is(originalMessage, 'spawn wrong command ENOENT');
const {originalMessage} = await t.throwsAsync(execa('noop', {cwd: 1}));
t.true(originalMessage.startsWith('The "options.cwd" property must be of type string. Received type number'));
});

test('failed is false on success', async t => {
Expand Down Expand Up @@ -205,6 +205,6 @@ test('error.code is undefined on success', async t => {
});

test('error.code is defined on failure if applicable', async t => {
const {code} = await t.throwsAsync(execa('invalid'));
t.is(code, 'ENOENT');
const {code} = await t.throwsAsync(execa('noop', {cwd: 1}));
t.is(code, 'ERR_INVALID_ARG_TYPE');
});

0 comments on commit bdbd975

Please sign in to comment.