[PR #417] [MERGED] fix(core): clean up timers and listeners in destroy() to allow process exit #1304

Closed
opened 2026-03-14 09:29:33 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/417
Author: @remorses
Created: 12/14/2025
Status: Merged
Merged: 12/15/2025
Merged by: @kommander

Base: mainHead: fix/process-exit-cleanup


📝 Commits (1)

  • 6985575 fix(core): clean up timers and listeners in destroy() to allow process exit

📊 Changes

1 file changed (+15 additions, -1 deletions)

View changed files

📝 packages/core/src/renderer.ts (+15 -1)

📄 Description

After #383 changed signal handlers to call destroy() instead of process.exit(), the process would hang instead of exiting because destroy() wasn't cleaning up all active handles.

  • Add removeExitListeners() call in destroy() to remove signal handlers
  • Remove beforeExit listener in destroy()
  • Clear resizeTimeoutId timeout in destroy()
  • Store and clear the 5-second capabilityTimeoutId that removes the capability handler

The 5-second capability timeout was the main culprit - it kept the event loop alive for exactly 5 seconds after Ctrl+C.

closes #405


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opentui/pull/417 **Author:** [@remorses](https://github.com/remorses) **Created:** 12/14/2025 **Status:** ✅ Merged **Merged:** 12/15/2025 **Merged by:** [@kommander](https://github.com/kommander) **Base:** `main` ← **Head:** `fix/process-exit-cleanup` --- ### 📝 Commits (1) - [`6985575`](https://github.com/anomalyco/opentui/commit/69855754e9dc7adcc78275279f7a7c0c7ea5c11b) fix(core): clean up timers and listeners in destroy() to allow process exit ### 📊 Changes **1 file changed** (+15 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/core/src/renderer.ts` (+15 -1) </details> ### 📄 Description After #383 changed signal handlers to call `destroy()` instead of `process.exit()`, the process would hang instead of exiting because `destroy()` wasn't cleaning up all active handles. - Add `removeExitListeners()` call in `destroy()` to remove signal handlers - Remove `beforeExit` listener in `destroy()` - Clear `resizeTimeoutId` timeout in `destroy()` - Store and clear the 5-second `capabilityTimeoutId` that removes the capability handler The 5-second capability timeout was the main culprit - it kept the event loop alive for exactly 5 seconds after Ctrl+C. closes #405 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-14 09:29:33 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#1304
No description provided.