mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 01:06:27 +00:00
logread should not panic on an EOF, instead exiting gracefully
Signed-off-by: Avi Deitcher <avi@deitcher.net>
This commit is contained in:
parent
7164b2c04d
commit
b7002c0eb2
@ -2,8 +2,10 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"strings"
|
||||
"time"
|
||||
@ -65,6 +67,9 @@ func main() {
|
||||
decoder := json.NewDecoder(conn)
|
||||
for {
|
||||
if err := decoder.Decode(&entry); err != nil {
|
||||
if errors.Is(err, net.ErrClosed) || errors.Is(err, io.EOF) {
|
||||
return
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user