mirror of
https://github.com/oven-sh/bun
synced 2026-02-13 04:18:58 +00:00
On Windows, when `bun run` spawns a child process that inherits the console, both the parent and child receive CTRL+C events simultaneously. Previously, the parent process would handle CTRL+C and potentially exit before the child process had a chance to handle the event gracefully. This change registers a console control handler in the parent process that ignores CTRL+C/CTRL+BREAK/CTRL+CLOSE events while a synchronous child process is running. This allows the child process to handle these events and exit gracefully, with the parent waiting for the child to complete. The implementation mirrors the existing POSIX signal forwarding pattern: - CTRL_C_EVENT -> SIGINT - CTRL_BREAK_EVENT -> SIGBREAK (similar to SIGQUIT) - CTRL_CLOSE_EVENT -> SIGHUP (console window closed) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>