diff options
author | baude <bbaude@redhat.com> | 2019-09-24 13:43:44 -0500 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2019-09-24 13:43:44 -0500 |
commit | 61a226fbd51de015e1753df451a2c67a689caf69 (patch) | |
tree | 84ac924a433f37d5fb4d40df2cef7b3705e8277b /pkg/adapter/containers_remote.go | |
parent | 83b2348313c52cc3e20d72285a9d81d3d72c2d5d (diff) | |
download | podman-61a226fbd51de015e1753df451a2c67a689caf69.tar.gz podman-61a226fbd51de015e1753df451a2c67a689caf69.tar.bz2 podman-61a226fbd51de015e1753df451a2c67a689caf69.zip |
conditionally send stdin on remote run
when running a container remotely, we should only be sending stdin when
running with --interactive; otherwise use nil.
Fixes: #4095
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/adapter/containers_remote.go')
-rw-r--r-- | pkg/adapter/containers_remote.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/adapter/containers_remote.go b/pkg/adapter/containers_remote.go index 01e008e87..6cecb92da 100644 --- a/pkg/adapter/containers_remote.go +++ b/pkg/adapter/containers_remote.go @@ -473,7 +473,12 @@ func (r *LocalRuntime) Run(ctx context.Context, c *cliconfig.RunValues, exitCode fmt.Println(cid) return 0, nil } - exitChan, errChan, err := r.attach(ctx, os.Stdin, os.Stdout, cid, true, c.String("detach-keys")) + inputStream := os.Stdin + // If -i is not set, clear stdin + if !c.Bool("interactive") { + inputStream = nil + } + exitChan, errChan, err := r.attach(ctx, inputStream, os.Stdout, cid, true, c.String("detach-keys")) if err != nil { return exitCode, err } |