Merge pull request #5974 from claudiubelu/hanging-task-delete-fix
task delete: Closes task IO before waiting
This commit is contained in:
commit
d081457ba4
@ -50,6 +50,10 @@ func openPipe(ctx context.Context, fn string, flag int, perm os.FileMode) (io.Re
|
|||||||
}
|
}
|
||||||
p.con = c
|
p.con = c
|
||||||
}()
|
}()
|
||||||
|
go func() {
|
||||||
|
<-ctx.Done()
|
||||||
|
p.Close()
|
||||||
|
}()
|
||||||
return p, nil
|
return p, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
task.go
1
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)
|
return nil, errors.Wrapf(errdefs.ErrFailedPrecondition, "task must be stopped before deletion: %s", status.Status)
|
||||||
}
|
}
|
||||||
if t.io != nil {
|
if t.io != nil {
|
||||||
|
t.io.Close()
|
||||||
t.io.Cancel()
|
t.io.Cancel()
|
||||||
t.io.Wait()
|
t.io.Wait()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user