Distinguish containerd failure from process exit code

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
v0.7
Paul "TBBle" Hampson 2020-01-06 08:04:02 +11:00
parent e11b881c12
commit b9cf317850
1 changed files with 6 additions and 1 deletions

View File

@ -193,7 +193,12 @@ func (w containerdExecutor) Exec(ctx context.Context, meta executor.Meta, root c
cancel()
}
if status.ExitCode() != 0 {
err := errors.Errorf("process returned non-zero exit code: %d", status.ExitCode())
var err error
if status.ExitCode() == containerd.UnknownExitStatus && status.Error() != nil {
err = errors.Wrap(status.Error(), "failure waiting for process")
} else {
err = errors.Errorf("process returned non-zero exit code: %d", status.ExitCode())
}
select {
case <-ctx.Done():
err = errors.Wrap(ctx.Err(), err.Error())