aboutsummaryrefslogtreecommitdiff
path: root/libpod/oci_conmon_linux.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2020-04-19 14:09:47 -0400
committerMatthew Heon <matthew.heon@pm.me>2020-05-14 16:56:02 -0400
commit2b08359fafae5f551e7ce27ff797b0d2e3df2d2c (patch)
tree0e0e2bbbf87b68509b082fe6e85a427a310a4cce /libpod/oci_conmon_linux.go
parentc76cf1735c1c9ec36abdf76d6c72b3f758d3d341 (diff)
downloadpodman-2b08359fafae5f551e7ce27ff797b0d2e3df2d2c.tar.gz
podman-2b08359fafae5f551e7ce27ff797b0d2e3df2d2c.tar.bz2
podman-2b08359fafae5f551e7ce27ff797b0d2e3df2d2c.zip
Fix start order for APIv2 exec start endpoint
This makes the endpoint (mostly) functional. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/oci_conmon_linux.go')
-rw-r--r--libpod/oci_conmon_linux.go31
1 files changed, 17 insertions, 14 deletions
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go
index a7d9abdce..56cfa8ccd 100644
--- a/libpod/oci_conmon_linux.go
+++ b/libpod/oci_conmon_linux.go
@@ -1777,6 +1777,7 @@ func httpAttachTerminalCopy(container *net.UnixConn, http *bufio.ReadWriter, cid
// Do nothing
default:
logrus.Errorf("Received unexpected attach type %+d, discarding %d bytes", buf[0], numR)
+ logrus.Debugf("String is %s", string(buf[1:numR]))
continue
}
@@ -2153,7 +2154,22 @@ func attachExecHTTP(c *Container, sessionID string, httpBuf *bufio.ReadWriter, s
attachStdin = streams.Stdin
}
- // Handle STDOUT/STDERR
+ // Next, STDIN. Avoid entirely if attachStdin unset.
+ if attachStdin {
+ go func() {
+ logrus.Debugf("Beginning STDIN copy")
+ _, err := utils.CopyDetachable(conn, httpBuf, detachKeys)
+ logrus.Debugf("STDIN copy completed")
+ errChan <- err
+ }()
+ }
+
+ // 4: send start message to child
+ if err := writeConmonPipeData(pipes.startPipe); err != nil {
+ return err
+ }
+
+ // Handle STDOUT/STDERR *after* start message is sent
go func() {
var err error
if isTerminal {
@@ -2174,19 +2190,6 @@ func attachExecHTTP(c *Container, sessionID string, httpBuf *bufio.ReadWriter, s
errChan <- err
logrus.Debugf("STDOUT/ERR copy completed")
}()
- // Next, STDIN. Avoid entirely if attachStdin unset.
- if attachStdin {
- go func() {
- _, err := utils.CopyDetachable(conn, httpBuf, detachKeys)
- logrus.Debugf("STDIN copy completed")
- errChan <- err
- }()
- }
-
- // 4: send start message to child
- if err := writeConmonPipeData(pipes.startPipe); err != nil {
- return err
- }
if cancel != nil {
select {