Summary
scripts/with-managed-process.sh uses negative array subscripts (${START_ARGS[-1]}), which require bash 4.3+. On macOS, the system bash is permanently stuck at 3.2.57 (Apple ships GPLv2 bash only), so the wrapper fails out of the box for macOS users who don't have a Homebrew bash on PATH.
Environment
- macOS (Apple Silicon),
/bin/bash = GNU bash 3.2.57(1)-release
- commit: 98bd7f3
Repro
./scripts/with-managed-process.sh --name web \
--command 'python3 -m http.server 18924 --bind 127.0.0.1' \
--port 18924 --timeout 30 -- 'curl -fsS http://127.0.0.1:18924'
Result:
with-managed-process.sh: line 31: START_ARGS: bad array subscript
Root cause
Lines 31–32 reference the just-pushed element via ${START_ARGS[-1]}. Negative indexing is unsupported before bash 4.3.
Suggested fix (bash 3.2 compatible)
Capture the pushed value before shift instead of indexing from the end:
START_ARGS+=("$1")
LAST_ARG="$1"
shift
if [ "$#" -gt 0 ] && [ "$LAST_ARG" != "--help" ]; then
case "$LAST_ARG" in
This is semantically identical and works on bash 3.2+.
Secondary note
The scripts/*.sh files ship without the execute bit (mode 0644), so invoking them by path gives permission denied until chmod +x is run. Consider committing them as executable.
Summary
scripts/with-managed-process.shuses negative array subscripts (${START_ARGS[-1]}), which require bash 4.3+. On macOS, the system bash is permanently stuck at 3.2.57 (Apple ships GPLv2 bash only), so the wrapper fails out of the box for macOS users who don't have a Homebrew bash on PATH.Environment
/bin/bash= GNU bash 3.2.57(1)-releaseRepro
Result:
Root cause
Lines 31–32 reference the just-pushed element via
${START_ARGS[-1]}. Negative indexing is unsupported before bash 4.3.Suggested fix (bash 3.2 compatible)
Capture the pushed value before
shiftinstead of indexing from the end:This is semantically identical and works on bash 3.2+.
Secondary note
The
scripts/*.shfiles ship without the execute bit (mode0644), so invoking them by path givespermission denieduntilchmod +xis run. Consider committing them as executable.