Feature Request: Escape/Cancel Hook for Process Cleanup
Resolved 💬 3 comments Opened Jul 29, 2025 by un33k Closed Jan 4, 2026
Feature Request: Escape/Cancel Hook for Process Cleanup
Problem: When running scripts that spawn background processes, pressing Escape terminates the parent script but leaves child processes running without cleanup.
Example Scenario:
foo.shlaunches a remote process and waits for response- User presses Escape to cancel
foo.shterminates immediately- Remote process continues running (no cleanup signal sent)
Proposed Solution: Add a cancellation hook that triggers when Escape is pressed, allowing scripts to:
- Send termination signals to child processes
- Close network connections
- Clean up temporary resources
- Gracefully shut down before exiting
Implementation: Could be exposed as:
- Signal handler for SIGINT/SIGTERM
- Explicit cancel callback registration
- "onCancel" hook in the script lifecycle
This would ensure proper cleanup when users interrupt long-running operations.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗