Skip to content

v2.1.2

Choose a tag to compare

@inureyes inureyes released this 26 Apr 22:25
· 98 commits to main since this release

This release fixes terminal mouse-tracking leakage on PTY disconnect, hardens panic-time terminal cleanup, and corrects two release-workflow misfires that surfaced after v2.1.1.

New Features

None

Improvements

  • Centralized terminal teardown logic: TerminalGuard::restore_terminal() in interactive_signal.rs now delegates to force_terminal_cleanup() instead of carrying its own incomplete cleanup, so the panic-hook path and the normal Drop path emit identical sequences.

Bug Fixes

  • Restore terminal mouse tracking state on PTY session disconnect (#190, supersedes #189): After a PTY session disconnects (normal exit, Ctrl+C, network drop, or panic), remote interactive programs (vim, tmux, htop) may have enabled mouse tracking on the local terminal. Without cleanup, the terminal remained in tracking mode and printed raw SGR escape sequences on mouse movement. All cleanup paths (TerminalStateGuard::Drop, force_terminal_cleanup, and the panic hook via TerminalGuard) now emit the full set of mouse-tracking-off sequences (modes 1000, 1002, 1003, 1006, 1015) plus cursor-show and alternate-screen-exit on teardown.
  • Make force_terminal_cleanup safe to call from the panic hook: switched the global TERMINAL_MUTEX acquisition to try_lock() so the panic-hook path cannot deadlock if the panicking thread already holds the mutex, and a poisoned mutex from a previous panic no longer triggers a secondary panic via unwrap(). The lock only serializes concurrent teardown; the underlying stdout writes and disable_raw_mode are individually safe.

CI/CD Improvements

  • Trigger Homebrew formula update only after the official release: release.yml now calls update_homebrew_formula.yml via workflow_call from the publish-release job (which converts pre-release to official) instead of workflow_run firing on every Release workflow completion (including pre-release builds). workflow_dispatch is kept for manual runs.
  • Prevent double-trigger of the release workflow: removed the published event type from the release workflow trigger list. The workflow was previously firing twice — once on prereleased from gh release create --prerelease, and again on published when publish-release converted the pre-release to official. publish-release already handles that conversion, and workflow_dispatch covers manual runs.

Technical Details

  • Added unit tests for force_terminal_cleanup() in src/pty/terminal.rs covering idempotency, poisoned-mutex resilience, and held-mutex resilience. Tests use local Mutex instances rather than the global TERMINAL_MUTEX so the global state is not disturbed for other tests in the same process.
  • Extended the force_terminal_cleanup() docstring to make explicit that "unsynchronized" means "without the lock" (not "skipped"), addressing the LOW-severity documentation finding from the earlier security review of #189.

Dependencies

None

Breaking Changes

None

Known Issues

None

What's Changed

  • fix: restore terminal mouse tracking state on PTY session disconnect by @inureyes in #190

Full Changelog: v2.1.1...v2.1.2