From 9b3550f70bf1612e2c474b3826b0347b21503401 Mon Sep 17 00:00:00 2001 From: Kevin Krakauer Date: Wed, 17 Oct 2018 10:50:24 -0700 Subject: runsc: Add --pid flag to runsc kill. --pid allows specific processes to be signalled rather than the container root process or all processes in the container. containerd needs to SIGKILL exec'd processes that timeout and check whether processes are still alive. PiperOrigin-RevId: 217547636 Change-Id: I2058ebb548b51c8eb748f5884fb88bad0b532e45 --- runsc/container/test_app.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'runsc/container/test_app.go') diff --git a/runsc/container/test_app.go b/runsc/container/test_app.go index 9e4b5326d..cc3b087e1 100644 --- a/runsc/container/test_app.go +++ b/runsc/container/test_app.go @@ -125,6 +125,7 @@ func server(listener net.Listener, out *os.File) { type taskTree struct { depth int width int + pause bool } // Name implements subcommands.Command. @@ -146,6 +147,7 @@ func (*taskTree) Usage() string { func (c *taskTree) SetFlags(f *flag.FlagSet) { f.IntVar(&c.depth, "depth", 1, "number of levels to create") f.IntVar(&c.width, "width", 1, "number of tasks at each level") + f.BoolVar(&c.pause, "pause", false, "whether the tasks should pause perpetually") } // Execute implements subcommands.Command. @@ -164,7 +166,8 @@ func (c *taskTree) Execute(ctx context.Context, f *flag.FlagSet, args ...interfa cmd := exec.Command( "/proc/self/exe", c.Name(), "--depth", strconv.Itoa(c.depth-1), - "--width", strconv.Itoa(c.width)) + "--width", strconv.Itoa(c.width), + "--pause", strconv.FormatBool(c.pause)) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr @@ -177,6 +180,11 @@ func (c *taskTree) Execute(ctx context.Context, f *flag.FlagSet, args ...interfa for _, c := range cmds { c.Wait() } + + if c.pause { + select {} + } + return subcommands.ExitSuccess } -- cgit v1.2.3