From f79a915136c5e62c3752598ce9c1e157a18acd6c Mon Sep 17 00:00:00 2001 From: Moliang Zhou Date: Sun, 12 Apr 2026 11:18:44 -0700 Subject: [PATCH] fix: add timeout fallback for macOS compatibility The `timeout` command (GNU Coreutils) is not available by default on macOS, causing the installation script to fail with 'timeout: command not found' during git clone. This adds a shell function fallback that: - Uses `gtimeout` if Homebrew coreutils is installed - Otherwise skips the timeout and runs the command directly --- run.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/run.sh b/run.sh index 7ad6f85d..8693ac06 100755 --- a/run.sh +++ b/run.sh @@ -28,6 +28,20 @@ if [ -z "$BASH_VERSION" ]; then exit 1 fi +# Fallback for 'timeout' on macOS where GNU Coreutils is not installed by default. +# If 'gtimeout' (Homebrew's coreutils) is present, we use it. Otherwise, we gracefully +# degrade by using `shift` to discard the time limit argument ($1) and executing the rest of the command. +if ! command -v timeout &> /dev/null; then + timeout() { + if command -v gtimeout &> /dev/null; then + gtimeout "$@" + else + shift + "$@" + fi + } +fi + # Get current script directory export BASE_DIR=$(cd "$(dirname "$0")"; pwd)