From 00bb910b6f5cfb201505f1658e8fc5e20df1c926 Mon Sep 17 00:00:00 2001 From: Johan Walles Date: Sun, 14 Jul 2024 12:25:17 +0200 Subject: [PATCH] Provide implementation hints for Windows --- twin/screen-setup-windows.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/twin/screen-setup-windows.go b/twin/screen-setup-windows.go index 7f08dbf..0bdcd4e 100644 --- a/twin/screen-setup-windows.go +++ b/twin/screen-setup-windows.go @@ -19,6 +19,11 @@ type interruptableReaderImpl struct { shutdownRequested atomic.Bool } +// NOTE: To work properly, this Read() should return immediately after somebody +// calls Interrupt(), *without first reading any bytes from the base reader*. +// +// This implementation doesn't do that. If you want to fix this, the not-Windows +// implementation in screen-setup.go may or may not work as inspiration. func (r *interruptableReaderImpl) Read(p []byte) (n int, err error) { if r.shutdownRequested.Load() { err = io.EOF