From b7245e486a96af0717311a2560474e2487e36053 Mon Sep 17 00:00:00 2001 From: webbrain-one <295484252+webbrain-one@users.noreply.github.com> Date: Sat, 15 Aug 2026 16:27:54 +0300 Subject: [PATCH] Fix save hanging on ipc.sock Skip socket files such as .codex/ipc/ipc.sock during save so `codex-accounts.sh save` does not block. --- codex-accounts.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/codex-accounts.sh b/codex-accounts.sh index 125dde4..44f2666 100755 --- a/codex-accounts.sh +++ b/codex-accounts.sh @@ -112,6 +112,23 @@ apply_shared_to_codex() { done } +copy_tree_ignoring_sockets() { + local src="$1" dst="$2" + local rel + mkdir -p "$dst" + ( + cd "$src" || exit 1 + find . -mindepth 1 -type d -print0 | + while IFS= read -r -d '' rel; do + mkdir -p "${dst}/${rel#./}" + done + find . -mindepth 1 \( -type f -o -type l \) -print0 | + while IFS= read -r -d '' rel; do + cp -P "$rel" "${dst}/${rel#./}" + done + ) +} + backup_current_to() { # Requires ~/.codex to exist local name="$1" @@ -123,7 +140,7 @@ backup_current_to() { note "Saving current ~/.codex to ${dest}..." save_shared_from_codex - cp -R "$CODEX_HOME" "${tmpdir}/.codex" + copy_tree_ignoring_sockets "$CODEX_HOME" "${tmpdir}/.codex" strip_shared_from_tree "${tmpdir}/.codex" ( cd "$tmpdir"