diff --git a/pkg/cri/io/helpers_windows.go b/pkg/cri/io/helpers_windows.go index c4f9e449f..1dbb1aa61 100644 --- a/pkg/cri/io/helpers_windows.go +++ b/pkg/cri/io/helpers_windows.go @@ -50,6 +50,10 @@ func openPipe(ctx context.Context, fn string, flag int, perm os.FileMode) (io.Re } p.con = c }() + go func() { + <-ctx.Done() + p.Close() + }() return p, nil } diff --git a/task.go b/task.go index ab7f9f0a8..4e23fb861 100644 --- a/task.go +++ b/task.go @@ -315,6 +315,7 @@ func (t *task) Delete(ctx context.Context, opts ...ProcessDeleteOpts) (*ExitStat return nil, errors.Wrapf(errdefs.ErrFailedPrecondition, "task must be stopped before deletion: %s", status.Status) } if t.io != nil { + t.io.Close() t.io.Cancel() t.io.Wait() }