diff options
author | Debarshi Ray <rishi@fedoraproject.org> | 2019-01-08 14:32:52 +0100 |
---|---|---|
committer | Debarshi Ray <rishi@fedoraproject.org> | 2019-01-08 16:34:09 +0100 |
commit | e02199f2a401079375454acb639534c6f4f83c7f (patch) | |
tree | 03b511bfb3b2b5871105f778ae570eb8e1e4a0f9 /cmd | |
parent | f71264e6126fa889306693b97177128da05836fe (diff) | |
download | podman-e02199f2a401079375454acb639534c6f4f83c7f.tar.gz podman-e02199f2a401079375454acb639534c6f4f83c7f.tar.bz2 podman-e02199f2a401079375454acb639534c6f4f83c7f.zip |
Default --sig-proxy to true for 'podman start --attach'
The --sig-proxy option in both 'podman attach' and 'podman run' default
to true, and there's no reason for 'podman start --attach' to be any
different. However, since it only makes sense to proxy signals when
the container is attached, 'podman start --sig-proxy' will continue to
error if --attach isn't used.
Signed-off-by: Debarshi Ray <rishi@fedoraproject.org>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/start.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/cmd/podman/start.go b/cmd/podman/start.go index 8bb386c68..df34deec2 100644 --- a/cmd/podman/start.go +++ b/cmd/podman/start.go @@ -27,9 +27,9 @@ var ( Name: "interactive, i", Usage: "Keep STDIN open even if not attached", }, - cli.BoolFlag{ + cli.BoolTFlag{ Name: "sig-proxy", - Usage: "proxy received signals to the process", + Usage: "proxy received signals to the process (default true if attaching, false otherwise)", }, LatestFlag, } @@ -67,8 +67,14 @@ func startCmd(c *cli.Context) error { return err } - if c.Bool("sig-proxy") && !attach { - return errors.Wrapf(libpod.ErrInvalidArg, "you cannot use sig-proxy without --attach") + sigProxy := c.BoolT("sig-proxy") + + if sigProxy && !attach { + if c.IsSet("sig-proxy") { + return errors.Wrapf(libpod.ErrInvalidArg, "you cannot use sig-proxy without --attach") + } else { + sigProxy = false + } } runtime, err := libpodruntime.GetRuntime(c) @@ -111,7 +117,7 @@ func startCmd(c *cli.Context) error { } // attach to the container and also start it not already running - err = startAttachCtr(ctr, os.Stdout, os.Stderr, inputStream, c.String("detach-keys"), c.Bool("sig-proxy"), !ctrRunning) + err = startAttachCtr(ctr, os.Stdout, os.Stderr, inputStream, c.String("detach-keys"), sigProxy, !ctrRunning) if ctrRunning { return err } |