mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 17:26:28 +00:00
Merge pull request #3937 from deitch/logread-exit-not-panic
logread should not panic on an EOF, instead exiting gracefully
This commit is contained in:
commit
8e790a5417
@ -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