summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclassabbyamp <dev@placeviolette.net>2023-09-15 17:02:07 -0400
committerclassabbyamp <dev@placeviolette.net>2023-09-17 13:42:03 -0400
commit2d6c286b4b5141665d025e2b40bc296a89a916fc (patch)
tree3d776fdbda68f530992e45f53ff12c2d4a734e8f
parentf957041a37b9e98053d5c78bcdd62a1e103cdefd (diff)
functions: fix unhelpful error for binary not found on PATH
with the config: ``` BINARIES=(nonexistant /usr/bin/nonexistant) ``` before: ``` ==> ERROR: file not found: '' ==> ERROR: file not found: '/usr/bin/nonexistant' ``` after: ``` ==> ERROR: binary not found: 'nonexistant' ==> ERROR: file not found: '/usr/bin/nonexistant' ```
-rw-r--r--functions5
1 files changed, 4 insertions, 1 deletions
diff --git a/functions b/functions
index bcb2345..a8c9103 100644
--- a/functions
+++ b/functions
@@ -745,7 +745,10 @@ add_binary() {
local line='' regex='' binary='' dest='' mode='' sodep='' resolved='' shebang='' interpreter=''
if [[ "${1:0:1}" != '/' ]]; then
- binary="$(type -P "$1")"
+ if ! binary="$(type -P "$1")"; then
+ error "binary not found: '%s'" "$1"
+ return 1
+ fi
else
binary="$1"
fi