« get me outta code hell

try friendlily harder to get ImageMagick to work - 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:
author(quasar) nebula <qznebula@protonmail.com>2022-06-18 17:23:40 -0300
committer(quasar) nebula <qznebula@protonmail.com>2022-06-18 17:23:40 -0300
commit9837da4b7ba6d2ec590a72859383c0424036eb1e (patch)
tree3e8b11028e57fdc6f66f78b8956013409b2e73d9 /src/util
parentb839fb97415e155ea25b29581fa605fe1f65b5f2 (diff)
try friendlily harder to get ImageMagick to work
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) {