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 <noreply@anthropic.com> (cherry picked from commit 3790b0c0f0b98286b78f6f5aa8dbc9756cf756e8)
This commit is contained in:
parent
2c1fd1f801
commit
f104dbc37f
1 changed files with 6 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue