From c27e06bcb98f0c3360660653735cd2d797437f14 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Wed, 19 Jan 2022 18:22:34 -0700 Subject: [PATCH] server: ensure last lines are always logged --- system/utils.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/system/utils.go b/system/utils.go index 999f038..8bf7781 100644 --- a/system/utils.go +++ b/system/utils.go @@ -68,6 +68,8 @@ func ScanReader(r io.Reader, callback func(line []byte)) error { return err } } + // Ensure that the scanner is always able to read the last line. + _, _ = buf.Write([]byte("\r\n")) // Publish the line for this loop. Break on new-line characters so every line is sent as a single // output event, otherwise you get funky handling in the browser console. s := bufio.NewScanner(buf)