summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2020-04-15 16:17:11 -0400
committerMatthew Heon <matthew.heon@pm.me>2020-05-14 16:56:01 -0400
commit4d410b7cb7191c2fdc4ff975136390b0a172a371 (patch)
tree67597ef1407c6cd76c5e861d821b8184990420a4 /libpod
parentce56b688712dad1095ab0c520fab5c0b7cedc68b (diff)
downloadpodman-4d410b7cb7191c2fdc4ff975136390b0a172a371.tar.gz
podman-4d410b7cb7191c2fdc4ff975136390b0a172a371.tar.bz2
podman-4d410b7cb7191c2fdc4ff975136390b0a172a371.zip
Ensure that Streams are set to defaults for HTTP attach
If not overridden, we should use the attach configuration given when the exec session was first created. Also, setting streams should not conflict with a TTY - the two are allowed together with Attach and should be allowed together here. Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_exec.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/libpod/container_exec.go b/libpod/container_exec.go
index 9698ecd19..8ae9df1ae 100644
--- a/libpod/container_exec.go
+++ b/libpod/container_exec.go
@@ -158,9 +158,6 @@ func (c *Container) ExecCreate(config *ExecConfig) (string, error) {
if len(config.Command) == 0 {
return "", errors.Wrapf(define.ErrInvalidArg, "must provide a non-empty command to start an exec session")
}
- if config.Terminal && (config.AttachStdin || config.AttachStdout || config.AttachStderr) {
- return "", errors.Wrapf(define.ErrInvalidArg, "cannot specify streams to attach to when exec session has a pseudoterminal")
- }
// Verify that we are in a good state to continue
if !c.ensureState(define.ContainerStateRunning) {
@@ -362,6 +359,13 @@ func (c *Container) ExecHTTPStartAndAttach(sessionID string, httpCon net.Conn, h
return err
}
+ if streams == nil {
+ streams = new(HTTPAttachStreams)
+ streams.Stdin = session.Config.AttachStdin
+ streams.Stdout = session.Config.AttachStdout
+ streams.Stderr = session.Config.AttachStderr
+ }
+
pid, attachChan, err := c.ociRuntime.ExecContainerHTTP(c, session.ID(), execOpts, httpCon, httpBuf, streams, cancel)
if err != nil {
return err