Skip to content

Commit f463d6a

Browse files
nchamoaztec-bot
authored andcommitted
fix(aztec-up): fall back to no timeout when /usr/bin/timeout absent (macOS) (#23310)
1 parent 155a8da commit f463d6a

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

aztec-up/bin/0.0.1/install

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,21 @@ function echo_yellow {
5555
}
5656

5757
function timeout {
58-
if [ "${CI:-0}" = "1" ] || [ "${CI:-0}" = "true" ]; then
58+
if [ "${CI:-0}" != "1" ] && [ "${CI:-0}" != "true" ]; then
59+
shift
60+
"$@"
61+
return
62+
fi
63+
if [ -x /usr/bin/timeout ]; then
64+
# Prefer coreutils `timeout` when available. Absolute path avoids re-entering this function.
5965
/usr/bin/timeout "$@"
66+
elif perl -e1 2>/dev/null; then
67+
# Fall back to perl's `alarm` when /usr/bin/timeout is missing.
68+
local duration=$1
69+
shift
70+
perl -e "alarm $duration; exec @ARGV" -- "$@"
6071
else
72+
# No timeout backend available -- run unguarded rather than fail the install.
6173
shift
6274
"$@"
6375
fi

0 commit comments

Comments
 (0)