Fix regressions in attach

* Wrong bool parsing
* Attach always all streams

Were introduced in #12120

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
Alexander Morozov
2015-04-09 09:58:44 -07:00
parent 6ba7bf440e
commit 0fec3e19db
2 changed files with 25 additions and 10 deletions
+16 -3
View File
@@ -1011,10 +1011,23 @@ func postContainersAttach(eng *engine.Engine, version version.Version, w http.Re
} else {
errStream = outStream
}
logs := r.Form.Get("logs") != ""
stream := r.Form.Get("stream") != ""
logs := toBool(r.Form.Get("logs"))
stream := toBool(r.Form.Get("stream"))
if err := cont.AttachWithLogs(inStream, outStream, errStream, logs, stream); err != nil {
var stdin io.ReadCloser
var stdout, stderr io.Writer
if toBool(r.Form.Get("stdin")) {
stdin = inStream
}
if toBool(r.Form.Get("stdout")) {
stdout = outStream
}
if toBool(r.Form.Get("stderr")) {
stderr = errStream
}
if err := cont.AttachWithLogs(stdin, stdout, stderr, logs, stream); err != nil {
fmt.Fprintf(outStream, "Error attaching: %s\n", err)
}
return nil