ctr: update task kill to take exec-id
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
This commit is contained in:
14
task_opts.go
14
task_opts.go
@@ -65,13 +65,23 @@ type KillInfo struct {
|
||||
// All kills all processes inside the task
|
||||
// only valid on tasks, ignored on processes
|
||||
All bool
|
||||
// ExecID is the ID of a process to kill
|
||||
ExecID string
|
||||
}
|
||||
|
||||
// KillOpts allows options to be set for the killing of a process
|
||||
type KillOpts func(context.Context, Process, *KillInfo) error
|
||||
type KillOpts func(context.Context, *KillInfo) error
|
||||
|
||||
// WithKillAll kills all processes for a task
|
||||
func WithKillAll(ctx context.Context, p Process, i *KillInfo) error {
|
||||
func WithKillAll(ctx context.Context, i *KillInfo) error {
|
||||
i.All = true
|
||||
return nil
|
||||
}
|
||||
|
||||
// WithKillExecID specifies the process ID
|
||||
func WithKillExecID(execID string) KillOpts {
|
||||
return func(ctx context.Context, i *KillInfo) error {
|
||||
i.ExecID = execID
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user