Skip to content

Commit 75dfb26

Browse files
committed
fix(install): avoid local in top-level error handler
Capture the failing command status in a regular variable before printf so the script stays POSIX-safe. Add an inline note that local is only valid inside functions.
1 parent 90144ad commit 75dfb26

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

app/install

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ set -- "$@" --quiet
77
BSH="$(
88
CDPATH='' cd -- "$(dirname -- "$0" 2>&1)" 2>&1 && pwd -P 2>&1
99
)"/../lib/base.sh || {
10-
local err=$?
10+
# Capture status before printf; local is invalid outside functions.
11+
err=$?
1112
printf >&2 %s\\n "$BSH"
12-
exit $err
13+
exit "$err"
1314
}
1415

1516
# shellcheck disable=SC2034 # Variable appears unused.

0 commit comments

Comments
 (0)