From e1c5fdac4a1be1f9d1e3d64499d5997094461712 Mon Sep 17 00:00:00 2001 From: LongQT-sea Date: Tue, 16 Dec 2025 16:49:34 +0700 Subject: [PATCH] fix: increase sleep to 5s to reduce rare detach_disk failures Rare detach_disk failures can still occur even after 10 attempts. Increasing the sleep duration to 5 seconds reduces the likelihood of these intermittent failures. --- mkmaciso | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mkmaciso b/mkmaciso index c75e627..363c5c1 100644 --- a/mkmaciso +++ b/mkmaciso @@ -99,12 +99,11 @@ detach_disk() { for attempt in $(seq 1 "$RETRIES_COUNT"); do log_info "Detach attempt $attempt of $RETRIES_COUNT..." - if hdiutil detach "$disk" 2>/dev/null || hdiutil detach "$disk" -force 2>/dev/null; then + if sync && sleep 5 && hdiutil detach "$disk" 2>/dev/null || hdiutil detach "$disk" -force 2>/dev/null; then log_info "Disk detached successfully" return 0 fi [ "$attempt" -lt "$RETRIES_COUNT" ] && log_warn "Detach failed, retrying..." - sleep 2 done log_error "Failed to detach $disk after $RETRIES_COUNT attempts"