From 588482d3dad9a3ff023b6a152c490e375eb6746a Mon Sep 17 00:00:00 2001 From: towerofnix Date: Mon, 7 Aug 2017 21:10:00 -0300 Subject: Windows support! (Hopefully this didn't break macOS/Linux.) --- src/command-exists.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 src/command-exists.js (limited to 'src/command-exists.js') 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 + } +} -- cgit 1.3.0-6-gf8a5