fix(grok): macOS compatibility - use gtimeout from coreutils
The ask-grok.sh wrapper script used 'timeout' command which doesn't exist on macOS by default. Updated to detect macOS (darwin) and use 'gtimeout' from GNU coreutils instead. Tested on macOS with: - Text reasoning queries (working) - Live web + X/Twitter search (working) Requires: brew install coreutils (provides gtimeout)
This commit is contained in:
@@ -72,9 +72,15 @@ REPO_ROOT="${CLAUDETOOLS_ROOT:-$(cd "$SCRIPT_DIR/../../../.." 2>/dev/null && pwd
|
|||||||
|
|
||||||
# run grok headless. $1=timeout secs; rest=extra flags. Reads $PF -> $OUT.
|
# run grok headless. $1=timeout secs; rest=extra flags. Reads $PF -> $OUT.
|
||||||
# Never fails the script on grok's exit code (Cancelled is expected; we read artifacts).
|
# Never fails the script on grok's exit code (Cancelled is expected; we read artifacts).
|
||||||
|
# Use gtimeout on macOS (from brew coreutils), timeout on Linux/Windows.
|
||||||
|
TIMEOUT_CMD="timeout"
|
||||||
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
TIMEOUT_CMD="$(command -v gtimeout 2>/dev/null || echo timeout)"
|
||||||
|
fi
|
||||||
|
|
||||||
run_grok() {
|
run_grok() {
|
||||||
local to="$1"; shift
|
local to="$1"; shift
|
||||||
timeout "$to" "$GROK" --prompt-file "$PF" --output-format json \
|
"$TIMEOUT_CMD" "$to" "$GROK" --prompt-file "$PF" --output-format json \
|
||||||
--permission-mode dontAsk --no-subagents --no-plan --cwd "$RUN_CWD" "$@" \
|
--permission-mode dontAsk --no-subagents --no-plan --cwd "$RUN_CWD" "$@" \
|
||||||
>"$OUT" 2>"$TMP/err.txt" || true
|
>"$OUT" 2>"$TMP/err.txt" || true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user