Skip to content

Commit

Permalink
server: ensure last lines are always logged
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewpi committed Jan 20, 2022
1 parent 13a9ee9 commit c27e06b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions system/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c27e06b

Please sign in to comment.