From df708831b662785c62323a754b9c7834acd4dac7 Mon Sep 17 00:00:00 2001 From: Adrian Rangel Date: Fri, 14 Aug 2026 00:19:25 -0600 Subject: [PATCH] Keep the Copy URL migration's browser prompt visible (#6842) gum draws its confirm UI on stderr, so the migration's `2>/dev/null` threw away the whole prompt while gum still held the terminal in raw mode reading keys. With a browser open, an update stopped after "Running migration (1786643346)" on an unpainted screen with no way to tell it was waiting for an answer. Nothing else in the repo suppresses gum's stderr; the redirect only ever hid gum's own error in the no-terminal case, where the migration already explains itself on stderr before deferring. Fixes #6841 Claude-Session: https://claude.ai/code/session_01So4yKzTDdJJp7orjnF8i1J Co-authored-by: Claude Opus 5 (1M context) --- migrations/1786643346.sh | 12 +++++++----- test/shell.d/copy-url-shortcut-migration-test.sh | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/migrations/1786643346.sh b/migrations/1786643346.sh index 1875ba1e..48cdb40b 100644 --- a/migrations/1786643346.sh +++ b/migrations/1786643346.sh @@ -134,12 +134,14 @@ if (( ! ${#pending[@]} )) && ! unverified_repairs_exist; then fi # A running browser holds Preferences in memory and rewrites the file on exit, -# reverting the repair, so ask for the windows to be closed first. Without a -# terminal to ask in, gum fails; then — as on decline — fail so the migration -# stays pending, and the login notifier keeps prompting until a rerun goes -# through with browsers closed. +# reverting the repair, so ask for the windows to be closed first. gum draws +# the prompt on stderr, so it must stay attached: suppressing it leaves gum +# waiting for a keypress behind an unpainted screen. Without a terminal to ask +# in, gum fails; then — as on decline — fail so the migration stays pending, +# and the login notifier keeps prompting until a rerun goes through with +# browsers closed. while browsers_running; do - if ! gum confirm "Close all browser windows to repair the Copy URL shortcut, then continue" 2>/dev/null; then + if ! gum confirm "Close all browser windows to repair the Copy URL shortcut, then continue"; then echo "A running browser would undo the Copy URL shortcut repair." >&2 echo "Close all browser windows, then run: omarchy-migrate" >&2 exit 1 diff --git a/test/shell.d/copy-url-shortcut-migration-test.sh b/test/shell.d/copy-url-shortcut-migration-test.sh index 6aad9a33..2783abeb 100644 --- a/test/shell.d/copy-url-shortcut-migration-test.sh +++ b/test/shell.d/copy-url-shortcut-migration-test.sh @@ -45,6 +45,20 @@ run_migration && fail "migration defers while a browser is running" fail "migration leaves preferences alone while a browser is running" pass "migration defers the repair while a browser is running" +# gum paints its prompt on stderr, so that stream has to stay attached: +# suppressing it leaves gum reading keys behind an unpainted screen, which +# reads as a hung update. +cat >"$stub_bin/gum" <<'STUB' +#!/bin/bash +echo "gum-prompt-painted" >&2 +exit 1 +STUB +prompt_stderr="$test_dir/prompt-stderr" +HOME="$home" PATH="$stub_bin:$PATH" bash -euo pipefail "$migration" >/dev/null 2>"$prompt_stderr" && + fail "migration defers when the browser prompt is declined" +grep -q "gum-prompt-painted" "$prompt_stderr" || fail "migration keeps the browser prompt visible" +pass "migration keeps the browser prompt visible" + # Confirming the prompt after closing the browser lets the repair proceed. cat >"$stub_bin/gum" <<'STUB' #!/bin/bash