1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

fix(node): errno property when command missing (#22691)

Fixes https://github.com/denoland/deno/issues/22604

`remix dev` with Node adapter works:
```
$ ~/gh/littledivy/deno/target/debug/deno task dev
Task dev remix dev --manual

 💿  remix dev

 info  building...
 info  built (619ms)
[remix-serve] http://localhost:3000 (http://192.168.1.24:3000)

GET / 200 - - 3.090 ms
```
This commit is contained in:
Divy Srivastava 2024-03-04 22:05:44 +05:30 committed by GitHub
parent 6650019935
commit 5a28d70e05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View file

@ -275,7 +275,11 @@ export class ChildProcess extends EventEmitter {
});
})();
} catch (err) {
this.#_handleError(err);
let e = err;
if (e instanceof Deno.errors.NotFound) {
e = _createSpawnSyncError("ENOENT", command, args);
}
this.#_handleError(e);
}
}

View file

@ -771,3 +771,15 @@ Deno.test(async function execFileWithUndefinedTimeout() {
);
await promise;
});
Deno.test(async function spawnCommandNotFoundErrno() {
const { promise, resolve } = Promise.withResolvers<void>();
const cp = CP.spawn("no-such-command");
cp.on("error", (err) => {
const errno = Deno.build.os === "windows" ? -4058 : -2;
// @ts-ignore: errno missing from typings
assertEquals(err.errno, errno);
resolve();
});
await promise;
});