« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/node-utils.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util/node-utils.js b/src/util/node-utils.js
index a46d6141..ad87cae3 100644
--- a/src/util/node-utils.js
+++ b/src/util/node-utils.js
@@ -2,6 +2,15 @@
 
 import { fileURLToPath } from 'url';
 
+import _commandExists from 'command-exists';
+
+// This package throws an error instead of returning false when the command
+// doesn't exist, for some reason. Yay for making logic more difficult!
+// Here's a straightforward workaround.
+export function commandExists(command) {
+    return _commandExists(command).then(() => true, () => false);
+}
+
 // Very cool function origin8ting in... http-music pro8a8ly!
 // Sorry if we happen to 8e violating past-us's copyright, lmao.
 export function promisifyProcess(proc, showLogging = true) {