Merge pull request #3983 from AkihiroSuda/ctr-events-ignore-err
ctr events: do not exit on an error
This commit is contained in:
commit
07de4eccf1
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/cmd/ctr/commands"
|
"github.com/containerd/containerd/cmd/ctr/commands"
|
||||||
"github.com/containerd/containerd/events"
|
"github.com/containerd/containerd/events"
|
||||||
|
"github.com/containerd/containerd/log"
|
||||||
"github.com/containerd/typeurl"
|
"github.com/containerd/typeurl"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
|
||||||
@ -54,11 +55,13 @@ var Command = cli.Command{
|
|||||||
if e.Event != nil {
|
if e.Event != nil {
|
||||||
v, err := typeurl.UnmarshalAny(e.Event)
|
v, err := typeurl.UnmarshalAny(e.Event)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
log.G(ctx).WithError(err).Warn("cannot unmarshal an event from Any")
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
out, err = json.Marshal(v)
|
out, err = json.Marshal(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
log.G(ctx).WithError(err).Warn("cannot marshal Any into JSON")
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if _, err := fmt.Println(
|
if _, err := fmt.Println(
|
||||||
|
Loading…
Reference in New Issue
Block a user