[Windows] CTRL_C_EVENT not handled by bun (umbrella issue)
This is to collect issues that are reporting ANSI escape sequences after CTRL+C in some windows terminals and shell, where it sends a CTRL_C_EVENT which is not handled by bun.
- https://github.com/anomalyco/opencode/issues/7062
- https://github.com/anomalyco/opencode/issues/6912
This umbrella issue appropriately collects ANSI escape sequence issues related to CTRL_C handling. Additional related issues found:
- #6189: In the Windows system, pressing Ctrl+C will automatically exit the terminal
- #5990: Ctrl+C interruption causes terminal corruption with ANSI escape sequences
- #3057: Ctrl+C should terminate child processes
- #2999: Provide means to disable Ctrl-C (Windows quits app instead of copy)
- #5071: Ctrl+C exiting app even when prompt input isn't empty
All of these appear to stem from improper CTRL_C_EVENT and signal handling on Windows. The umbrella issue structure is good for tracking the root cause.
on windows bun, the ctrl+c sigint gets sent to all process+childprocess, so the bun run wrapper instantly kills its child. i need to check what happens with the published app too... i have a bun wip branch that is a poc fixing this, but it janky. not sure its something opentui/opencode can handle as a workaround if its parent process is killing it
Is this issue for collecting reports until the Bun team fixes it or are temporary workarounds in OpenCode also accepted?
I have submitted a PR to the Bun team resolving this for us
https://github.com/oven-sh/bun/pull/25876
I am seeing about adding tests. Also need to investigate the wider impact of this change. So there's more for me to do on this PR. Hoping for guidance from the Bun team tho.
I am seeing about adding tests. Also need to investigate the wider impact of this change. So there's more for me to do on this PR. Hoping for guidance from the Bun team tho.
Thanks for doing this! I press Ctrl+C out of habit and get kicked out 4-5x a day. Ugh.