aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/attach.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-04-11 13:09:41 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-04-13 18:43:44 +0000
commit5e03cec7ec83f8ff8b31a89a6180dda203b04d9c (patch)
treeb32484a6c5d15f430fca12f07db974e354636ccc /cmd/podman/attach.go
parentb8394600d855a88b38f01feeadf5a63e703183cd (diff)
downloadpodman-5e03cec7ec83f8ff8b31a89a6180dda203b04d9c.tar.gz
podman-5e03cec7ec83f8ff8b31a89a6180dda203b04d9c.tar.bz2
podman-5e03cec7ec83f8ff8b31a89a6180dda203b04d9c.zip
Changes to attach to enable per-stream attaching
This allows us to attach to attach to just stdout or stderr or stdin, or any combination of these. Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #608 Approved by: baude
Diffstat (limited to 'cmd/podman/attach.go')
-rw-r--r--cmd/podman/attach.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/cmd/podman/attach.go b/cmd/podman/attach.go
index 20c1c306d..4b16d013c 100644
--- a/cmd/podman/attach.go
+++ b/cmd/podman/attach.go
@@ -1,6 +1,8 @@
package main
import (
+ "os"
+
"github.com/pkg/errors"
"github.com/projectatomic/libpod/libpod"
"github.com/urfave/cli"
@@ -71,7 +73,12 @@ func attachCmd(c *cli.Context) error {
ProxySignals(ctr)
}
- if err := ctr.Attach(c.Bool("no-stdin"), c.String("detach-keys")); err != nil {
+ inputStream := os.Stdin
+ if c.Bool("no-stdin") {
+ inputStream = nil
+ }
+
+ if err := attachCtr(ctr, os.Stdout, os.Stderr, inputStream, c.String("detach-keys")); err != nil {
return errors.Wrapf(err, "error attaching to container %s", ctr.ID())
}