Commit d51b8f5
committed
Drain buffered output on Windows after cancellation
When a child exits, the run cancels its pending I/O. On Windows, a read
issued after that cancellation returned `nil` without consuming bytes
already buffered in the pipe, dropping output the child had already
written. The kqueue and epoll backends drain the descriptor on this
path; the IOCP backend did not.
`registerHandle()` now surfaces its registration outcome so `read()`
detects the cancelled state before issuing any I/O and drains the buffer
itself. `write()` reports a zero-length write on the same path. Both
previously issued an overlapped operation and returned without awaiting
it, leaving the kernel to write into a buffer the call had already
released.1 parent 4a6012f commit d51b8f5
2 files changed
Lines changed: 332 additions & 137 deletions
0 commit comments