From f104dbc37f8caf7ec2fffe5be19a4b16e4f4067a Mon Sep 17 00:00:00 2001 From: sugakoji Date: Sun, 22 Feb 2026 23:21:58 +0900 Subject: [PATCH] Fix double-open on partial failure with multiple URLs When multiple URLs were passed and some succeeded but others failed, the fallback re-opened all URLs via /usr/bin/open, causing duplicates. Now only failed URLs are passed to the system open fallback. Co-Authored-By: Claude Opus 4.6 (cherry picked from commit 3790b0c0f0b98286b78f6f5aa8dbc9756cf756e8) --- Resources/bin/open | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Resources/bin/open b/Resources/bin/open index 4000fed6..b161e8b7 100755 --- a/Resources/bin/open +++ b/Resources/bin/open @@ -54,13 +54,13 @@ if [[ ! -x "$CMUX_CLI" ]]; then exec /usr/bin/open "$@" fi -# Open each URL in cmux's in-app browser. -failed=false +# Open each URL in cmux's in-app browser; track failures individually. +failed_urls=() for url in "${urls[@]}"; do - "$CMUX_CLI" browser open "$url" 2>/dev/null || failed=true + "$CMUX_CLI" browser open "$url" 2>/dev/null || failed_urls+=("$url") done -# If any failed, fall back to system open for all URLs. -if [[ "$failed" == true ]]; then - exec /usr/bin/open "$@" +# Fall back to system open only for URLs that failed. +if [[ ${#failed_urls[@]} -gt 0 ]]; then + exec /usr/bin/open "${failed_urls[@]}" fi