From 3ada88c9e72c5b59f0998edd633e71b8a12ecded Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 12 Sep 2016 10:32:47 -0700 Subject: [PATCH] Continue for list on errors This will print out the error on stderr when loading a container but still list everything that was sucessful. Signed-off-by: Michael Crosby --- list.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/list.go b/list.go index dc54ab15b..930594b6e 100644 --- a/list.go +++ b/list.go @@ -121,15 +121,18 @@ func getContainers(context *cli.Context) ([]containerState, error) { if item.IsDir() { container, err := factory.Load(item.Name()) if err != nil { - return nil, err + fmt.Fprintf(os.Stderr, "load container %s: %v\n", item.Name(), err) + continue } containerStatus, err := container.Status() if err != nil { - return nil, err + fmt.Fprintf(os.Stderr, "status for %s: %v\n", item.Name(), err) + continue } state, err := container.State() if err != nil { - return nil, err + fmt.Fprintf(os.Stderr, "state for %s: %v\n", item.Name(), err) + continue } pid := state.BaseState.InitProcessPid if containerStatus == libcontainer.Stopped {