From cd9062641b0d4ada12038f80e415d0ba2eb5912d Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Tue, 2 Apr 2013 11:02:19 -0700 Subject: [PATCH] Activate Config.StdinOnce at argument parsing Upstream-commit: aea2675f7b2e4aa8bf63c8472af40bc059bd5d14 Component: engine --- components/engine/commands.go | 1 - components/engine/container.go | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/components/engine/commands.go b/components/engine/commands.go index ee481fd282..299ae0e4f5 100644 --- a/components/engine/commands.go +++ b/components/engine/commands.go @@ -874,7 +874,6 @@ func (srv *Server) CmdRun(stdin io.ReadCloser, stdout io.Writer, args ...string) if !config.Detach { var attachErr chan error if config.OpenStdin { - config.StdinOnce = true Debugf("Attaching with stdin\n") attachErr = container.Attach(stdin, stdout, stdout) } else { diff --git a/components/engine/container.go b/components/engine/container.go index 4f320f32fd..a11539180e 100644 --- a/components/engine/container.go +++ b/components/engine/container.go @@ -101,6 +101,10 @@ func ParseRun(args []string, stdout io.Writer) (*Config, error) { Cmd: runCmd, Image: image, } + // When allocating stdin in attached mode, close stdin at client disconnect + if config.OpenStdin && !config.Detach { + config.StdinOnce = true + } return config, nil }