command-exists icon indicating copy to clipboard operation
command-exists copied to clipboard

commandExists should return boolean instead of rejecting

Open vihanb opened this issue 6 years ago • 3 comments
trafficstars

Unless there was an error with checking if the command exists. It would make more sense and be more idiomatic to have a resolve(true/false) rather than rejecting in the case of the command not existing. This also means you can use async/await syntax: const exists = await commandExists('the-command')

vihanb avatar Dec 15 '18 08:12 vihanb

In addition this currently throw null as an error. Which if not handled locally, will tell absolutely nothing when caught in general error handler.

Huulivoide avatar Mar 18 '19 14:03 Huulivoide

Thanks @vihanb @Huulivoide. I don't have time to implement this change at the moment, but would accept a PR for it.

mathisonian avatar Mar 18 '19 20:03 mathisonian

You can check my fork that does what you want : https://github.com/raftario/command-exists The changes were too significant for me to open a PR, and it's not compatible with Node <6, so I decided to publish it as a separate module.

raftario avatar May 09 '19 20:05 raftario