Merge pull request #3307 from rhatdan/126
If container is not in correct state podman exec should exit with 126
This commit is contained in:
commit
9faff31421
|
|
@ -125,5 +125,10 @@ func execCmd(c *cliconfig.ExecValues) error {
|
||||||
streams.AttachError = true
|
streams.AttachError = true
|
||||||
streams.AttachInput = true
|
streams.AttachInput = true
|
||||||
|
|
||||||
return ctr.Exec(c.Tty, c.Privileged, envs, cmd, c.User, c.Workdir, streams, c.PreserveFDs)
|
err = ctr.Exec(c.Tty, c.Privileged, envs, cmd, c.User, c.Workdir, streams, c.PreserveFDs)
|
||||||
|
if errors.Cause(err) == libpod.ErrCtrStateInvalid {
|
||||||
|
exitCode = 126
|
||||||
|
}
|
||||||
|
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
// TODO can probably relax this once we track exec sessions
|
||||||
if conState != ContainerStateRunning {
|
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 {
|
if privileged || c.config.Privileged {
|
||||||
capList = caps.GetAllCapabilities()
|
capList = caps.GetAllCapabilities()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue