Merge pull request #1705 from baude/twostepjson

read conmon output and convert to json in two steps
This commit is contained in:
OpenShift Merge Robot
2018-10-23 11:56:02 -07:00
committed by GitHub

View File

@ -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
}