From acd9c668647d273488772bfcb06a0f1a44dfb411 Mon Sep 17 00:00:00 2001 From: baude Date: Wed, 8 Nov 2017 15:14:33 -0600 Subject: Fix terminal attach Re-order the startup of a new container via run from initialize > start > attach to initialize > attach > start. This fixes output when running: kpod run -i -t IMAGE command and kpod run IMAGE command Signed-off-by: baude --- cmd/kpod/create.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cmd/kpod/create.go') diff --git a/cmd/kpod/create.go b/cmd/kpod/create.go index bbfeaebae..0a0e31c40 100644 --- a/cmd/kpod/create.go +++ b/cmd/kpod/create.go @@ -319,6 +319,14 @@ func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime) (*createConfig, er blkioWeight = uint16(u) } + // Because we cannot do a non-terminal attach, we need to set tty to true + // if detach is not false + // TODO Allow non-terminal attach + tty := c.Bool("tty") + if !c.Bool("detach") && !tty { + tty = true + } + config := &createConfig{ capAdd: c.StringSlice("cap-add"), capDrop: c.StringSlice("cap-drop"), @@ -387,7 +395,7 @@ func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime) (*createConfig, er storageOpts: c.StringSlice("storage-opt"), sysctl: sysctl, tmpfs: c.StringSlice("tmpfs"), - tty: c.Bool("tty"), + tty: tty, user: uid, group: gid, volumes: c.StringSlice("volume"), -- cgit v1.2.3-54-g00ecf