Skip to content
Myr

fix: use CancelIoEx to cancel Windows conInputReader across threads (#1305)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

The Windows conInputReader uses `windows.CancelIo` to close the read loop's input handle. Windows `CancelIo` docs indicate that call is only appropriate for I/O operations on the same thread as the `CancelIo` call. Since the read loop is in its own goroutine, it's likely to be on another thread from the bubbletea Program. This change adds a call to Windows `CancelIoEx`, which will cancel I/O operations across threads. Fixes #1167

authored by Adam Woodbeck · committed by GitHub · parent 22ba68a · Browse files · 1 file+1 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:inputreader_windows.go+1 added-1 removed
55 unmodified lines
56// Cancel implements cancelreader.CancelReader.57func (r *conInputReader) Cancel() bool {58 r.setCanceled()5960 return windows.CancelIo(r.conin) == nil60 return windows.CancelIoEx(r.conin, nil) == nil || windows.CancelIo(r.conin) == nil61}6263// Close implements cancelreader.CancelReader.64func (r *conInputReader) Close() error {
43 unmodified lines