Sfoglia il codice sorgente

Activate Config.StdinOnce at argument parsing

Solomon Hykes 12 anni fa
parent
commit
aea2675f7b
2 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. 0 1
      commands.go
  2. 4 0
      container.go

+ 0 - 1
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 {

+ 4 - 0
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
 }