aboutsummaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2019-06-12 05:13:26 -0400
committerMatthew Heon <matthew.heon@pm.me>2019-06-25 12:45:01 -0400
commita19975f96d2ee7efe186d9aa0be42285cfafa3f4 (patch)
tree52040f3019eaedda85bd80759e766baa80d70cc1 /libpod
parent96ccc2edf597a191fe03eff98b2905788a26553f (diff)
downloadpodman-a19975f96d2ee7efe186d9aa0be42285cfafa3f4.tar.gz
podman-a19975f96d2ee7efe186d9aa0be42285cfafa3f4.tar.bz2
podman-a19975f96d2ee7efe186d9aa0be42285cfafa3f4.zip
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 <dwalsh@redhat.com> <Fixed conflicts> Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_api.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go
index 4eaf737b0..832801aeb 100644
--- a/libpod/container_api.go
+++ b/libpod/container_api.go
@@ -285,7 +285,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()