diff options
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 + } +} |