mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 20:24:31 +00:00
runtime: do not check for EOF error in console watcher
The documentation of the bufio package explicitly says "Err returns the first non-EOF error that was encountered by the Scanner." When io.EOF happens, `Err()` will return `nil` and `Scan()` will return `false`. Fixes #4079 Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
This commit is contained in:
parent
5d43718494
commit
8052fe62fa
@ -1037,15 +1037,13 @@ func (cw *consoleWatcher) start(s *Sandbox) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := scanner.Err(); err != nil {
|
if err := scanner.Err(); err != nil {
|
||||||
if err == io.EOF {
|
s.Logger().WithError(err).WithFields(logrus.Fields{
|
||||||
s.Logger().Info("console watcher quits")
|
"console-protocol": cw.proto,
|
||||||
} else {
|
"console-url": cw.consoleURL,
|
||||||
s.Logger().WithError(err).WithFields(logrus.Fields{
|
"sandbox": s.id,
|
||||||
"console-protocol": cw.proto,
|
}).Error("Failed to read guest console logs")
|
||||||
"console-url": cw.consoleURL,
|
} else { // The error is `nil` in case of io.EOF
|
||||||
"sandbox": s.id,
|
s.Logger().Info("console watcher quits")
|
||||||
}).Error("Failed to read guest console logs")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user