diff --git a/cc-ci-plan/launch.sh b/cc-ci-plan/launch.sh index 2cd14ca..0957b6a 100755 --- a/cc-ci-plan/launch.sh +++ b/cc-ci-plan/launch.sh @@ -23,6 +23,10 @@ set -euo pipefail +# Absolute path to this script, so the watchdog re-invokes it correctly regardless of how it +# was called or what cwd the tmux session uses (a relative $0 breaks once we cd into PLAN_DIR). +SELF="$(readlink -f "${BASH_SOURCE[0]}")" + # ----- config ------------------------------------------------------------- PLAN_DIR="${PLAN_DIR:-/srv/cc-ci/cc-ci-plan}" CLAUDE_BIN="${CLAUDE_BIN:-claude}" @@ -181,7 +185,7 @@ start_watchdog() { fi log "starting watchdog" tmux new-session -d -s "$WATCHDOG_SESSION" -c "$PLAN_DIR" \ - "exec >>'$LOG_DIR/watchdog.log' 2>&1; '$0' watchdog" + "exec >>'$LOG_DIR/watchdog.log' 2>&1; '$SELF' watchdog" } stop_loops() {