diff options
author | Matthew Heon <matthew.heon@pm.me> | 2020-03-23 16:18:17 -0400 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2020-03-26 13:33:33 -0400 |
commit | e42cbdd1b2f6788a814d6aa1838111989cd424ad (patch) | |
tree | 5705b12daaa8324c659717e72dfa523f83f5785b /libpod/container_exec.go | |
parent | 0c40b62c77d8f7dba8e73ac3ced0de536ec220d5 (diff) | |
download | podman-e42cbdd1b2f6788a814d6aa1838111989cd424ad.tar.gz podman-e42cbdd1b2f6788a814d6aa1838111989cd424ad.tar.bz2 podman-e42cbdd1b2f6788a814d6aa1838111989cd424ad.zip |
Add bindings for Container Exec Create + Inspect
Also adds some basic tests for these two. More tests are needed
but will have to wait for state to be finished.
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/container_exec.go')
-rw-r--r-- | libpod/container_exec.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libpod/container_exec.go b/libpod/container_exec.go index 795eb7453..912c2c226 100644 --- a/libpod/container_exec.go +++ b/libpod/container_exec.go @@ -231,6 +231,11 @@ func (c *Container) ExecStartAndAttach(sessionID string, streams *AttachStreams) } } + // Verify that we are in a good state to continue + if !c.ensureState(define.ContainerStateRunning) { + return errors.Wrapf(define.ErrCtrStateInvalid, "can only start exec sessions when their container is running") + } + session, ok := c.state.ExecSessions[sessionID] if !ok { return errors.Wrapf(define.ErrNoSuchExecSession, "container %s has no exec session with ID %s", c.ID(), sessionID) |