summaryrefslogtreecommitdiff
path: root/pkg/bindings
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2020-07-10 16:17:34 -0400
committerMatthew Heon <matthew.heon@pm.me>2020-07-10 17:15:33 -0400
commitbe4b4bd862bb8eb5d0680209db5c060befccfc24 (patch)
treec2a52aa2ca2004eba03ed159ec77f56e705beee6 /pkg/bindings
parent2ac8c6953481eb7391a6a7594709811f7ae3167f (diff)
downloadpodman-be4b4bd862bb8eb5d0680209db5c060befccfc24.tar.gz
podman-be4b4bd862bb8eb5d0680209db5c060befccfc24.tar.bz2
podman-be4b4bd862bb8eb5d0680209db5c060befccfc24.zip
Correctly print STDOUT on non-terminal remote exec
I confused STDIN and STDOUT's file descriptors (it's 0 and 1, I thought they were 1 and 0). As such, we were looking at whether we wanted to print STDIN when we looked to print STDOUT. This bool was set when `-i` was set in at the `podman exec` command line, which masked the problem when it was set. Fixes #6890 Fixes #6891 Fixes #6892 Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'pkg/bindings')
-rw-r--r--pkg/bindings/containers/attach.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/bindings/containers/attach.go b/pkg/bindings/containers/attach.go
index 077bb244f..297563688 100644
--- a/pkg/bindings/containers/attach.go
+++ b/pkg/bindings/containers/attach.go
@@ -457,15 +457,15 @@ func ExecStartAndAttach(ctx context.Context, sessionID string, streams *define.A
switch {
case fd == 0:
- if streams.AttachOutput {
+ if streams.AttachInput {
+ // Write STDIN to STDOUT (echoing characters
+ // typed by another attach session)
if _, err := streams.OutputStream.Write(frame[0:l]); err != nil {
return err
}
}
case fd == 1:
- if streams.AttachInput {
- // Write STDIN to STDOUT (echoing characters
- // typed by another attach session)
+ if streams.AttachOutput {
if _, err := streams.OutputStream.Write(frame[0:l]); err != nil {
return err
}