mirror of
https://github.com/containers/podman.git
synced 2025-10-25 18:25:59 +08:00
Merge pull request #1705 from baude/twostepjson
read conmon output and convert to json in two steps
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package libpod
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
@ -418,7 +419,12 @@ func (r *OCIRuntime) createOCIContainer(ctr *Container, cgroupParent string, res
|
||||
ch := make(chan syncStruct)
|
||||
go func() {
|
||||
var si *syncInfo
|
||||
if err = json.NewDecoder(parentPipe).Decode(&si); err != nil {
|
||||
rdr := bufio.NewReader(parentPipe)
|
||||
b, err := rdr.ReadBytes('\n')
|
||||
if err != nil {
|
||||
ch <- syncStruct{err: err}
|
||||
}
|
||||
if err := json.Unmarshal(b, &si); err != nil {
|
||||
ch <- syncStruct{err: err}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user