summaryrefslogtreecommitdiff
path: root/cmd/podman/start.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/start.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/start.go')
-rw-r--r--cmd/podman/start.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/podman/start.go b/cmd/podman/start.go
index 1a57a538b..14b03ac7c 100644
--- a/cmd/podman/start.go
+++ b/cmd/podman/start.go
@@ -95,7 +95,7 @@ func startCmd(c *cli.Context) error {
if c.Bool("interactive") && !ctr.Config().Stdin {
return errors.Errorf("the container was not created with the interactive option")
}
- noStdIn := c.Bool("interactive")
+
tty, err := strconv.ParseBool(ctr.Spec().Annotations["io.kubernetes.cri-o.TTY"])
if err != nil {
return errors.Wrapf(err, "unable to parse annotations in %s", ctr.ID())
@@ -105,7 +105,12 @@ func startCmd(c *cli.Context) error {
// We only get a terminal session if both a tty was specified in the spec and
// -a on the command-line was given.
if attach && tty {
- attachChan, err := ctr.StartAndAttach(noStdIn, c.String("detach-keys"))
+ inputStream := os.Stdin
+ if !c.Bool("interactive") {
+ inputStream = nil
+ }
+
+ attachChan, err := startAttachCtr(ctr, os.Stdout, os.Stderr, inputStream, c.String("detach-keys"))
if err != nil {
return errors.Wrapf(err, "unable to start container %s", ctr.ID())
}