diff options
author | towerofnix <towerofnix@gmail.com> | 2017-08-07 21:10:00 -0300 |
---|---|---|
committer | towerofnix <towerofnix@gmail.com> | 2017-08-07 21:12:19 -0300 |
commit | 588482d3dad9a3ff023b6a152c490e375eb6746a (patch) | |
tree | 5a78d0e2ac765d105718075ad7877e6d744130b4 /src/command-exists.js | |
parent | e70c189576a80a162a3183172aac74f288e66ccd (diff) |
Windows support!
(Hopefully this didn't break macOS/Linux.)
Diffstat (limited to 'src/command-exists.js')
-rwxr-xr-x | src/command-exists.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/command-exists.js b/src/command-exists.js new file mode 100755 index 0000000..9921364 --- /dev/null +++ b/src/command-exists.js @@ -0,0 +1,12 @@ +const npmCommandExists = require('command-exists') + +module.exports = async function commandExists(command) { + // When the command-exists module sees that a given command doesn't exist, it + // throws an error instead of returning false, which is not what we want. + + try { + return await npmCommandExists(command) + } catch(err) { + return false + } +} |