Skip to content

Commit 3ada88c

Browse files
committed
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 <[email protected]>
1 parent 124187b commit 3ada88c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

list.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,18 @@ func getContainers(context *cli.Context) ([]containerState, error) {
121121
if item.IsDir() {
122122
container, err := factory.Load(item.Name())
123123
if err != nil {
124-
return nil, err
124+
fmt.Fprintf(os.Stderr, "load container %s: %v\n", item.Name(), err)
125+
continue
125126
}
126127
containerStatus, err := container.Status()
127128
if err != nil {
128-
return nil, err
129+
fmt.Fprintf(os.Stderr, "status for %s: %v\n", item.Name(), err)
130+
continue
129131
}
130132
state, err := container.State()
131133
if err != nil {
132-
return nil, err
134+
fmt.Fprintf(os.Stderr, "state for %s: %v\n", item.Name(), err)
135+
continue
133136
}
134137
pid := state.BaseState.InitProcessPid
135138
if containerStatus == libcontainer.Stopped {

0 commit comments

Comments
 (0)