From 3b222b4b89096d67306ea866f24a97b55bce512e Mon Sep 17 00:00:00 2001 From: Codex Date: Mon, 25 May 2026 05:16:12 +0000 Subject: [PATCH] Fix Codex upgrade script edge cases --- scripts/start-codex-app-server | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/start-codex-app-server b/scripts/start-codex-app-server index 172507c..eec75a6 100755 --- a/scripts/start-codex-app-server +++ b/scripts/start-codex-app-server @@ -42,7 +42,9 @@ USAGE } pid_from_file() { - tr -cd '0-9' < "$PID_FILE" 2>/dev/null || true + if [[ -f "$PID_FILE" ]]; then + tr -cd '0-9' < "$PID_FILE" 2>/dev/null || true + fi } server_pid() { @@ -349,7 +351,10 @@ extract_codex_binary() { tar -xzf "$archive" -C "$dest/extract" found="$(find "$dest/extract" -type f -name codex -print | head -n 1)" if [[ -z "$found" ]]; then - echo "downloaded archive does not contain a codex binary" >&2 + found="$(find "$dest/extract" -type f -name 'codex-*' -perm -u+x -print | head -n 1)" + fi + if [[ -z "$found" ]]; then + echo "downloaded archive does not contain a Codex executable" >&2 return 1 fi chmod +x "$found"