mirror of
https://github.com/containers/podman.git
synced 2025-10-26 02:35:43 +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
|
package libpod
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -418,7 +419,12 @@ func (r *OCIRuntime) createOCIContainer(ctr *Container, cgroupParent string, res
|
|||||||
ch := make(chan syncStruct)
|
ch := make(chan syncStruct)
|
||||||
go func() {
|
go func() {
|
||||||
var si *syncInfo
|
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}
|
ch <- syncStruct{err: err}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user