turbo
ca712aba - fix: Deliver Ctrl-C to ConPTY children during graceful shutdown on Windows (#13069)

Commit
50 days ago
fix: Deliver Ctrl-C to ConPTY children during graceful shutdown on Windows (#13069) ### Why On Windows with the TUI, quitting turbo never gracefully stops task scripts. Tasks run under ConPTY in TUI mode, so they are attached to a pseudoconsole rather than turbo's console — the `CTRL_C_EVENT` the TUI generates never reaches them. The Windows graceful shutdown path sent nothing at all to children, so shutdown either hung waiting for processes that would never see a signal, or escalated to a hard `TerminateProcess`/`TerminateJobObject`, denying scripts any chance to clean up. ### What - Graceful shutdown now writes an ETX (`\x03`) keystroke to the child's ConPTY input pipe. conhost translates it into a `CTRL_C_EVENT` for the attached process tree — exactly what happens when a user types Ctrl-C in a terminal. - The ConPTY input writer is now shared between stdin forwarding and the shutdown path (it can only be taken from the pty once). A side effect is the input pipe stays open for the child's lifetime, which is desirable since ConPTY terminates children whose stdin pipe closes. - Non-pty (stream mode) children are unchanged: they share turbo's console and receive console Ctrl-C events directly. ### How to test `turbo dev` (or the repro from the linked issue) in TUI mode on Windows, press Ctrl-C: scripts now receive their SIGINT/Ctrl-C handlers and exit cleanly instead of being force killed. Verified against the original issue's repro. Note on coverage: pty tests are skipped on Windows CI (`TEST_PTY = !cfg!(windows)`), and an attempt at a Windows-only ConPTY regression test hung on the headless CI runners, so it was removed. This path is verified manually.
Author
Parents
Loading