Merge pull request #5956 from claudiubelu/windows/fixes-task-delete-force
Fixes task kill --force on Windows
This commit is contained in:
commit
8cf06feac4
12
task_opts.go
12
task_opts.go
@ -158,7 +158,17 @@ func WithProcessKill(ctx context.Context, p Process) error {
|
||||
return err
|
||||
}
|
||||
if err := p.Kill(ctx, syscall.SIGKILL, WithKillAll); err != nil {
|
||||
if errdefs.IsFailedPrecondition(err) || errdefs.IsNotFound(err) {
|
||||
// Kill might still return an IsNotFound error, even if it actually
|
||||
// killed the process.
|
||||
if errdefs.IsNotFound(err) {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
case <-s:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
if errdefs.IsFailedPrecondition(err) {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user