mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
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 <crosbymichael@gmail.com>
This commit is contained in:
@@ -121,15 +121,18 @@ func getContainers(context *cli.Context) ([]containerState, error) {
|
|||||||
if item.IsDir() {
|
if item.IsDir() {
|
||||||
container, err := factory.Load(item.Name())
|
container, err := factory.Load(item.Name())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
fmt.Fprintf(os.Stderr, "load container %s: %v\n", item.Name(), err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
containerStatus, err := container.Status()
|
containerStatus, err := container.Status()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
fmt.Fprintf(os.Stderr, "status for %s: %v\n", item.Name(), err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
state, err := container.State()
|
state, err := container.State()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
fmt.Fprintf(os.Stderr, "state for %s: %v\n", item.Name(), err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
pid := state.BaseState.InitProcessPid
|
pid := state.BaseState.InitProcessPid
|
||||||
if containerStatus == libcontainer.Stopped {
|
if containerStatus == libcontainer.Stopped {
|
||||||
|
|||||||
Reference in New Issue
Block a user