diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-10-20 14:03:13 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-20 14:03:13 +0000 |
commit | 09aade7816e096550e805869f1300d7198aa8f91 (patch) | |
tree | 77ad099aae7e8189eb22bdf2afa40b4651f2384b /libpod/oci_attach_linux.go | |
parent | c15c1540837b25305729bc72d61372098e204151 (diff) | |
parent | 46f7d2af189530a1f81d5e0aab5244667846e181 (diff) | |
download | podman-09aade7816e096550e805869f1300d7198aa8f91.tar.gz podman-09aade7816e096550e805869f1300d7198aa8f91.tar.bz2 podman-09aade7816e096550e805869f1300d7198aa8f91.zip |
Merge pull request #12040 from mheon/341_release
Bump to v3.4.1
Diffstat (limited to 'libpod/oci_attach_linux.go')
-rw-r--r-- | libpod/oci_attach_linux.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/libpod/oci_attach_linux.go b/libpod/oci_attach_linux.go index de435b58a..702628aa8 100644 --- a/libpod/oci_attach_linux.go +++ b/libpod/oci_attach_linux.go @@ -84,7 +84,7 @@ func (c *Container) attach(streams *define.AttachStreams, keys string, resize <- if attachRdy != nil { attachRdy <- true } - return readStdio(streams, receiveStdoutError, stdinDone) + return readStdio(conn, streams, receiveStdoutError, stdinDone) } // Attach to the given container's exec session @@ -165,7 +165,7 @@ func (c *Container) attachToExec(streams *define.AttachStreams, keys *string, se return err } - return readStdio(streams, receiveStdoutError, stdinDone) + return readStdio(conn, streams, receiveStdoutError, stdinDone) } func processDetachKeys(keys string) ([]byte, error) { @@ -208,11 +208,6 @@ func setupStdioChannels(streams *define.AttachStreams, conn *net.UnixConn, detac var err error if streams.AttachInput { _, err = utils.CopyDetachable(conn, streams.InputStream, detachKeys) - if err == nil { - if connErr := conn.CloseWrite(); connErr != nil { - logrus.Errorf("unable to close conn: %q", connErr) - } - } } stdinDone <- err }() @@ -265,7 +260,7 @@ func redirectResponseToOutputStreams(outputStream, errorStream io.Writer, writeO return err } -func readStdio(streams *define.AttachStreams, receiveStdoutError, stdinDone chan error) error { +func readStdio(conn *net.UnixConn, streams *define.AttachStreams, receiveStdoutError, stdinDone chan error) error { var err error select { case err = <-receiveStdoutError: @@ -274,6 +269,12 @@ func readStdio(streams *define.AttachStreams, receiveStdoutError, stdinDone chan if err == define.ErrDetach { return err } + if err == nil { + // copy stdin is done, close it + if connErr := conn.CloseWrite(); connErr != nil { + logrus.Errorf("Unable to close conn: %v", connErr) + } + } if streams.AttachOutput || streams.AttachError { return <-receiveStdoutError } |