[PR #7860] fix(tui): improve macOS terminal restoration on exit #12540

Open
opened 2026-02-16 18:17:26 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/7860

State: open
Merged: No


fixes: #7861

Summary:

Fixes the "dead terminal" issue that occurs when opencode exits on macOS, leaving users with a corrupted terminal state that requires manual reset.

Changes:

  • Enhanced signal handling for SIGINT, SIGHUP, SIGTERM
  • Improved suspend/resume with proper alternate screen buffer management
  • Comprehensive exit cleanup with terminal reset sequences
  • Added macOS terminal detection utility
  • Added test script for validation
  • Integrated tests into CI workflows

Technical Details:

  • Uses proper ANSI escape sequences for terminal restoration
  • Implements graceful signal cleanup to prevent memory leaks
  • Added platform-specific terminal buffer management
  • All TypeScript errors resolved

Testing:

  • Manual testing on macOS Terminal and iTerm2
  • Automated test script validates all functionality
  • CI integration ensures future compatibility
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7860 **State:** open **Merged:** No --- fixes: #7861 Summary: Fixes the "dead terminal" issue that occurs when opencode exits on macOS, leaving users with a corrupted terminal state that requires manual reset. Changes: - ✅ Enhanced signal handling for SIGINT, SIGHUP, SIGTERM - ✅ Improved suspend/resume with proper alternate screen buffer management - ✅ Comprehensive exit cleanup with terminal reset sequences - ✅ Added macOS terminal detection utility - ✅ Added test script for validation - ✅ Integrated tests into CI workflows Technical Details: - Uses proper ANSI escape sequences for terminal restoration - Implements graceful signal cleanup to prevent memory leaks - Added platform-specific terminal buffer management - All TypeScript errors resolved Testing: - ✅ Manual testing on macOS Terminal and iTerm2 - ✅ Automated test script validates all functionality - ✅ CI integration ensures future compatibility
yindo added the pull-request label 2026-02-16 18:17:26 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12540