Fix Codex upgrade script edge cases

This commit is contained in:
Codex
2026-05-25 05:16:12 +00:00
parent 41f1e2e1d0
commit 3b222b4b89

View File

@@ -42,7 +42,9 @@ USAGE
}
pid_from_file() {
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"