aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-01-08 09:04:17 -0800
committerGitHub <noreply@github.com>2019-01-08 09:04:17 -0800
commit757906189eabbc56a3b7e9723e9f72c3ccc654b0 (patch)
tree03b511bfb3b2b5871105f778ae570eb8e1e4a0f9
parent9474b8cea239348d11c913b03b9461afaf663f0b (diff)
parente02199f2a401079375454acb639534c6f4f83c7f (diff)
downloadpodman-757906189eabbc56a3b7e9723e9f72c3ccc654b0.tar.gz
podman-757906189eabbc56a3b7e9723e9f72c3ccc654b0.tar.bz2
podman-757906189eabbc56a3b7e9723e9f72c3ccc654b0.zip
Merge pull request #2094 from debarshiray/wip/debarshiray/podman-start-sig-proxy-default-doc
Mention the default --sig-proxy value for 'podman start'
-rw-r--r--cmd/podman/start.go16
-rw-r--r--docs/podman-start.1.md2
-rw-r--r--test/e2e/start_test.go10
3 files changed, 22 insertions, 6 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
}
diff --git a/docs/podman-start.1.md b/docs/podman-start.1.md
index cfd44ac3a..f16a20efa 100644
--- a/docs/podman-start.1.md
+++ b/docs/podman-start.1.md
@@ -35,7 +35,7 @@ to run containers such as CRI-O, the last started container could be from either
**--sig-proxy**=*true*|*false*
-Proxy received signals to the process (non-TTY mode only). SIGCHLD, SIGSTOP, and SIGKILL are not proxied. The default is false.
+Proxy received signals to the process (non-TTY mode only). SIGCHLD, SIGSTOP, and SIGKILL are not proxied. The default is *true* when attaching, *false* otherwise.
## EXAMPLE
diff --git a/test/e2e/start_test.go b/test/e2e/start_test.go
index 64245c609..9d7ac145c 100644
--- a/test/e2e/start_test.go
+++ b/test/e2e/start_test.go
@@ -115,4 +115,14 @@ var _ = Describe("Podman start", func() {
numContainers := podmanTest.NumberOfContainers()
Expect(numContainers).To(Equal(1))
})
+
+ It("podman start --sig-proxy should not work without --attach", func() {
+ session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"start", "-l", "--sig-proxy"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+ })
})