From 3bbb692d807277da991a96b336bf88a84b35964d Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Wed, 12 Jun 2019 05:13:26 -0400 Subject: If container is not in correct state podman exec should exit with 126 This way a tool can determine if the container exists or not, but is in the wrong state. Since 126 is documeted as: **_126_** if the **_contained command_** cannot be invoked It makes sense that the container would exit with this state. Signed-off-by: Daniel J Walsh --- libpod/container_api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libpod/container_api.go') diff --git a/libpod/container_api.go b/libpod/container_api.go index 1894780de..52d3afc0a 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -241,7 +241,7 @@ func (c *Container) Exec(tty, privileged bool, env, cmd []string, user, workDir // TODO can probably relax this once we track exec sessions if conState != ContainerStateRunning { - return errors.Errorf("cannot exec into container that is not running") + return errors.Wrapf(ErrCtrStateInvalid, "cannot exec into container that is not running") } if privileged || c.config.Privileged { capList = caps.GetAllCapabilities() -- cgit v1.2.3-54-g00ecf