Howdy! This is an explanation for #56
For various reasons, cmd isn't in always in the system path on windows. This makes calls to spawn fail with an ENOENT
.
This wouldn't be an issue on its own, except that open
gives no way to trap that error. Because the open
function is async, by the time the promise resolves and we have access to a ChildProcess that we can add an error event listener to, the error event has already fired and bubbled up to the top level, crashing the program with an ENOENT
.
Repro for windows:
index.js
to some non-existent binary like "abcmd"open('http://github.com')
.then(proc => {
proc.on('error', () => {}); // Trap child process error.
})
.catch(() => {}); // Prevent `unhandledRejection` error, just in case.
Full repro available here.
git clone https://github.com/heyimalex/open.git -b issue_144_repro open_issue_144
cd open_issue_144
npm install
node repro.js
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too