« get me outta code hell

command-exists.js « src - http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
path: root/src/command-exists.js
blob: 9921364168bf1636f884eb8bd2142b6ec18b5143 (plain)
1
2
3
4
5
6
7
8
9
10
11
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
  }
}