From 73b9e4c4304357a05fc4b50317f9327cb8a16540 Mon Sep 17 00:00:00 2001 From: baude Date: Thu, 21 Sep 2017 09:55:56 -0500 Subject: [PATCH] BUGFIX: If runtime cannot be found, error out In the case where the runtime cannot be found, kpod should error out. This occurs in kpod ps when iterating through the containers to get details. Signed-off-by: baude --- cmd/kpod/common.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/kpod/common.go b/cmd/kpod/common.go index 1c1503e2..996bf0fc 100644 --- a/cmd/kpod/common.go +++ b/cmd/kpod/common.go @@ -4,6 +4,7 @@ import ( "os" "strings" + "fmt" is "github.com/containers/image/storage" "github.com/containers/storage" "github.com/fatih/camelcase" @@ -93,6 +94,10 @@ func getConfig(c *cli.Context) (*libkpod.Config, error) { if c.GlobalIsSet("runtime") { config.Runtime = c.GlobalString("runtime") } + if _, err := os.Stat(config.Runtime); os.IsNotExist(err) { + // path to runtime does not exist + return config, fmt.Errorf("invalid --runtime value %q", err) + } return config, nil }