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:
9
task.go
9
task.go
@@ -163,10 +163,17 @@ func (t *task) Start(ctx context.Context) error {
|
||||
return errdefs.FromGRPC(err)
|
||||
}
|
||||
|
||||
func (t *task) Kill(ctx context.Context, s syscall.Signal) error {
|
||||
func (t *task) Kill(ctx context.Context, s syscall.Signal, opts ...KillOpts) error {
|
||||
var i KillInfo
|
||||
for _, o := range opts {
|
||||
if err := o(ctx, t, &i); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
_, err := t.client.TaskService().Kill(ctx, &tasks.KillRequest{
|
||||
Signal: uint32(s),
|
||||
ContainerID: t.id,
|
||||
All: i.All,
|
||||
})
|
||||
if err != nil {
|
||||
return errdefs.FromGRPC(err)
|
||||
|
Reference in New Issue
Block a user