From 60cf4f60140a89a2feee3072bd93f7faeaae5bc0 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Mon, 11 Nov 2019 09:19:35 -0800 Subject: [PATCH] log errors in scanner and manually close logging pipe if we hit an error in the scanner --- log.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/log.go b/log.go index 021de1f4e..ff12c94c0 100644 --- a/log.go +++ b/log.go @@ -43,6 +43,10 @@ func logOutput() (logOutput io.Writer, err error) { } os.Stderr.WriteString(fmt.Sprint(scanner.Text() + "\n")) } + if err := scanner.Err(); err != nil { + os.Stderr.WriteString(err.Error()) + w.Close() + } }(scanner) logOutput = w }