From fc46f85547bcd61f2139df65390587367663a960 Mon Sep 17 00:00:00 2001 From: alex Date: Sat, 21 Dec 2024 11:15:13 -0800 Subject: [PATCH] ssh: improve error handling on connection failure --- mirror-all | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mirror-all b/mirror-all index c6c975b..8ccbd8e 100755 --- a/mirror-all +++ b/mirror-all @@ -123,12 +123,12 @@ find_remote_directories() { log_info "finding all git repos in $SERVER:$TARGET" - readarray -d '' repos < <("$SSH" "$SERVER" -- "$LS" "$TARGET" --zero) + readarray -d '' repos < <("$SSH" -o BatchMode=yes "$SERVER" -- "$LS" "$TARGET" --zero 2>/dev/null) for i in "${repos[@]}"; do set +e local target="$TARGET/${i}" - if [[ "true" == "$("$SSH" "$SERVER" -- "$GIT" -C "$target" rev-parse --is-bare-repository 2>&1)" ]]; then + if [[ "true" == "$("$SSH" -o BatchMode=yes "$SERVER" -- "$GIT" -C "$target" rev-parse --is-bare-repository 2>&1)" ]]; then if [[ -d "$i" ]]; then TO_FETCH+=("$SERVER:$target") else -- 2.39.5