Add KillOpts for killing all processes

Fixes #1431

This adds KillOpts so that a client can specify when they want to kill a
single process or all the processes inside a container.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-08-28 11:10:15 -04:00
parent b9879d46f4
commit ed6b8fb0aa
5 changed files with 97 additions and 4 deletions

View File

@@ -51,3 +51,17 @@ func WithProcessKill(ctx context.Context, p Process) error {
<-s
return nil
}
type KillInfo struct {
// All kills all processes inside the task
// only valid on tasks, ignored on processes
All bool
}
type KillOpts func(context.Context, Process, *KillInfo) error
// WithKillAll kills all processes for a task
func WithKillAll(ctx context.Context, p Process, i *KillInfo) error {
i.All = true
return nil
}