From 6f2fd272da8499b4fba352f83505d1774e0af0af Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Mon, 3 Jun 2013 17:39:29 -0700 Subject: [PATCH] Fix stale command with stdout is not allocated Upstream-commit: 0ca88443985e7a944106ed4ceaf877a97f1ca2ec Component: engine --- components/engine/container.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/components/engine/container.go b/components/engine/container.go index c6b7c8a51c..ef449653c4 100644 --- a/components/engine/container.go +++ b/components/engine/container.go @@ -355,6 +355,17 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s errors <- err }() } + } else { + go func() { + defer stdinCloser.Close() + + cStdout, err := container.StdoutPipe() + if err != nil { + utils.Debugf("Error stdout pipe") + return + } + io.Copy(&utils.NopWriter{}, cStdout) + }() } if stderr != nil { nJobs += 1 @@ -381,7 +392,19 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s errors <- err }() } + } else { + go func() { + defer stdinCloser.Close() + + cStderr, err := container.StdoutPipe() + if err != nil { + utils.Debugf("Error stdout pipe") + return + } + io.Copy(&utils.NopWriter{}, cStderr) + }() } + return utils.Go(func() error { if cStdout != nil { defer cStdout.Close()