From 5a6184a535b62d9b5515d18d8561641d3f3d04cb Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Wed, 11 Jan 2017 22:10:50 -0800 Subject: [PATCH] Close stdout/stderr fifo as soon as possible Signed-off-by: Tonis Tiigi --- container/stream/streams.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/container/stream/streams.go b/container/stream/streams.go index 79f366afda..bbfe4af61d 100644 --- a/container/stream/streams.go +++ b/container/stream/streams.go @@ -113,12 +113,13 @@ func (c *Config) CloseStreams() error { // CopyToPipe connects streamconfig with a libcontainerd.IOPipe func (c *Config) CopyToPipe(iop libcontainerd.IOPipe) { - copyFunc := func(w io.Writer, r io.Reader) { + copyFunc := func(w io.Writer, r io.ReadCloser) { c.Add(1) go func() { if _, err := pools.Copy(w, r); err != nil { logrus.Errorf("stream copy error: %+v", err) } + r.Close() c.Done() }() }