Merge pull request #5956 from claudiubelu/windows/fixes-task-delete-force

Fixes task kill --force on Windows
This commit is contained in:
Phil Estes 2021-09-13 10:26:00 -04:00 committed by GitHub
commit 8cf06feac4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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