mirror of
https://github.com/containers/podman.git
synced 2025-06-23 02:18:13 +08:00
Merge pull request #13637 from Luap99/conmon-err
readConmonPipeData: try to improve error
This commit is contained in:
@ -1587,11 +1587,13 @@ func readConmonPipeData(runtimeName string, pipe *os.File, ociLog string) (int,
|
||||
var si *syncInfo
|
||||
rdr := bufio.NewReader(pipe)
|
||||
b, err := rdr.ReadBytes('\n')
|
||||
if err != nil {
|
||||
// ignore EOF here, error is returned even when data was read
|
||||
// if it is no valid json unmarshal will fail below
|
||||
if err != nil && !errors.Is(err, io.EOF) {
|
||||
ch <- syncStruct{err: err}
|
||||
}
|
||||
if err := json.Unmarshal(b, &si); err != nil {
|
||||
ch <- syncStruct{err: err}
|
||||
ch <- syncStruct{err: fmt.Errorf("conmon bytes %q: %w", string(b), err)}
|
||||
return
|
||||
}
|
||||
ch <- syncStruct{si: si}
|
||||
|
Reference in New Issue
Block a user