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) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
5e5197a081
commit
df708831b6
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user