Skip to content

fix(ui): force terminal restore if spinner cleanup times out - #1086

Merged
cdalar merged 1 commit into
mainfrom
fix/spinner-terminal-restore
Sep 5, 2026
Merged

cdalar merged 1 commit into
mainfrom
fix/spinner-terminal-restore

Conversation

@cdalar

@cdalar cdalar commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Spinner.Stop() waited up to 500ms for bubbletea's async goroutine to restore the pty (echo, raw mode) before returning.
  • Command error paths call s.Stop() immediately followed by log.Fatalln(err), which calls os.Exit() directly and skips all defers β€” if bubbletea hadn't finished its restore within that window, the process died with the pty stuck in raw mode for the rest of the shell session (no echo, and later output missing line-feed post-processing, e.g. staircased hcloud help text).
  • Capture the terminal's pristine cooked-mode state once before any spinner ever engages raw mode, and force-restore it if Stop()'s wait times out, so an os.Exit() right after can no longer strand the terminal.

Test plan

  • go build ./...
  • go vet ./internal/ui/...
  • Manually reproduce a Hetzner deploy error (e.g. invalid location) and confirm the shell is left in a usable state afterward

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01TRdmSy4Vdaua7eKpZCe33Z

Stop() waited up to 500ms for bubbletea's async goroutine to restore
the pty (echo, raw mode) before returning. Command error paths call
s.Stop() immediately followed by log.Fatalln(err), which os.Exit()s
directly and skips all defers β€” if bubbletea hadn't finished restoring
within that window, the process died with the pty stuck in raw mode
for the rest of the shell session (no echo, and later output missing
line-feed post-processing).

Capture the terminal's pristine cooked-mode state once before any
spinner engages raw mode, and force-restore it if Stop()'s wait times
out, so an os.Exit() right after can no longer strand the terminal.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TRdmSy4Vdaua7eKpZCe33Z
@cdalar
cdalar merged commit 1efa2d2 into main Sep 5, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

⌂ 捒网址