diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-11-01 14:34:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-01 14:34:40 +0100 |
commit | 69165fa04d9db306809a0b110491f9a572f74431 (patch) | |
tree | 4399ffe534b5dbbb4a0963ba07a60f15c2d2eb73 | |
parent | 9a28a12c9bc6f681558f7aa6f797765262fab81b (diff) | |
parent | 1df4dba0a0c335ad68b1c2202b8099cd87aa3d94 (diff) | |
download | podman-69165fa04d9db306809a0b110491f9a572f74431.tar.gz podman-69165fa04d9db306809a0b110491f9a572f74431.tar.bz2 podman-69165fa04d9db306809a0b110491f9a572f74431.zip |
Merge pull request #4400 from haircommander/exec-hang
Switch to bufio Reader for exec streams
-rw-r--r-- | libpod/container_api.go | 3 | ||||
-rw-r--r-- | libpod/healthcheck.go | 4 | ||||
-rw-r--r-- | pkg/adapter/containers.go | 4 | ||||
-rw-r--r-- | pkg/adapter/terminal_linux.go | 3 | ||||
-rw-r--r-- | pkg/varlinkapi/attach.go | 2 |
5 files changed, 10 insertions, 6 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go index 1b2d52ce3..a6f5b54d5 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -1,6 +1,7 @@ package libpod import ( + "bufio" "context" "io" "io/ioutil" @@ -361,7 +362,7 @@ type AttachStreams struct { // ErrorStream will be attached to container's STDERR ErrorStream io.WriteCloser // InputStream will be attached to container's STDIN - InputStream io.Reader + InputStream *bufio.Reader // AttachOutput is whether to attach to STDOUT // If false, stdout will not be attached AttachOutput bool diff --git a/libpod/healthcheck.go b/libpod/healthcheck.go index 68ffc2349..e9c950713 100644 --- a/libpod/healthcheck.go +++ b/libpod/healthcheck.go @@ -133,7 +133,9 @@ func (c *Container) runHealthCheck() (HealthCheckStatus, error) { streams := new(AttachStreams) streams.OutputStream = hcw streams.ErrorStream = hcw - streams.InputStream = os.Stdin + + streams.InputStream = bufio.NewReader(os.Stdin) + streams.AttachOutput = true streams.AttachError = true streams.AttachInput = true diff --git a/pkg/adapter/containers.go b/pkg/adapter/containers.go index ea5c54814..64550f545 100644 --- a/pkg/adapter/containers.go +++ b/pkg/adapter/containers.go @@ -900,7 +900,7 @@ func (r *LocalRuntime) execPS(c *libpod.Container, args []string) ([]string, err streams := new(libpod.AttachStreams) streams.OutputStream = wPipe streams.ErrorStream = wPipe - streams.InputStream = os.Stdin + streams.InputStream = bufio.NewReader(os.Stdin) streams.AttachOutput = true streams.AttachError = true streams.AttachInput = true @@ -978,7 +978,7 @@ func (r *LocalRuntime) ExecContainer(ctx context.Context, cli *cliconfig.ExecVal streams.OutputStream = os.Stdout streams.ErrorStream = os.Stderr if cli.Interactive { - streams.InputStream = os.Stdin + streams.InputStream = bufio.NewReader(os.Stdin) streams.AttachInput = true } streams.AttachOutput = true diff --git a/pkg/adapter/terminal_linux.go b/pkg/adapter/terminal_linux.go index 16e552802..3dc5864e2 100644 --- a/pkg/adapter/terminal_linux.go +++ b/pkg/adapter/terminal_linux.go @@ -1,6 +1,7 @@ package adapter import ( + "bufio" "context" "fmt" "os" @@ -61,7 +62,7 @@ func StartAttachCtr(ctx context.Context, ctr *libpod.Container, stdout, stderr, streams := new(libpod.AttachStreams) streams.OutputStream = stdout streams.ErrorStream = stderr - streams.InputStream = stdin + streams.InputStream = bufio.NewReader(stdin) streams.AttachOutput = true streams.AttachError = true streams.AttachInput = true diff --git a/pkg/varlinkapi/attach.go b/pkg/varlinkapi/attach.go index 37adbbf55..5beca3c6f 100644 --- a/pkg/varlinkapi/attach.go +++ b/pkg/varlinkapi/attach.go @@ -32,7 +32,7 @@ func setupStreams(call iopodman.VarlinkCall) (*bufio.Reader, *bufio.Writer, *io. streams := libpod.AttachStreams{ OutputStream: stdoutWriter, - InputStream: pr, + InputStream: bufio.NewReader(pr), // Runc eats the error stream ErrorStream: stdoutWriter, AttachInput: true, |