commit
9dee46bbfa
|
@ -89,16 +89,19 @@ func (w containerdExecutor) Exec(ctx context.Context, meta executor.Meta, root c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
killCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
var cancel func()
|
||||||
|
|
||||||
ctxDone := ctx.Done()
|
ctxDone := ctx.Done()
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctxDone:
|
case <-ctxDone:
|
||||||
ctxDone = nil
|
ctxDone = nil
|
||||||
|
var killCtx context.Context
|
||||||
|
killCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
task.Kill(killCtx, syscall.SIGKILL)
|
task.Kill(killCtx, syscall.SIGKILL)
|
||||||
case status := <-statusCh:
|
case status := <-statusCh:
|
||||||
cancel()
|
if cancel != nil {
|
||||||
|
cancel()
|
||||||
|
}
|
||||||
if status.ExitCode() != 0 {
|
if status.ExitCode() != 0 {
|
||||||
return errors.Errorf("process returned non-zero exit code: %d", status.ExitCode())
|
return errors.Errorf("process returned non-zero exit code: %d", status.ExitCode())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue