From cffff5fb0fb384f0de463c3789179d7bd2b081e6 Mon Sep 17 00:00:00 2001 From: Dima Krasner Date: Mon, 14 Oct 2024 07:47:32 +0300 Subject: [PATCH] if socket is closed, unblock the writer until done --- front/text/line.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/front/text/line.go b/front/text/line.go index f27b1df1..7fd2a5f3 100644 --- a/front/text/line.go +++ b/front/text/line.go @@ -73,6 +73,14 @@ func LineBuffered(inner io.Writer) *LineWriter { _, err := w.inner.Write(w.buffer.Bytes()) if err != nil { w.done <- err + + // continue reading until closed, to unblock the writing routine + for { + if _, ok := <-w.c; !ok { + break + } + } + return }