From f2abd692e909d92aae2e95177804eb199d4be50e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=9Fur=20Tafral=C4=B1?= Date: Thu, 9 Apr 2026 06:07:22 +0300 Subject: [PATCH] Fix Windows container exit code handling and error checks (#6411) --- pipeline/backend/docker/docker.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pipeline/backend/docker/docker.go b/pipeline/backend/docker/docker.go index e495c2394..78f5d8a0f 100644 --- a/pipeline/backend/docker/docker.go +++ b/pipeline/backend/docker/docker.go @@ -279,8 +279,12 @@ func (e *docker) WaitStep(ctx context.Context, step *backend_types.Step, taskUUI select { case resp := <-wait.Result: log.Trace().Msgf("ContainerWait returned with resp: %v", resp) + if resp.Error != nil { + return nil, fmt.Errorf("ContainerWait error: %s", resp.Error.Message) + } case err := <-wait.Error: log.Trace().Msgf("ContainerWait returned with err: %v", err) + return nil, err case <-ctx.Done(): return nil, ctx.Err() } @@ -290,9 +294,15 @@ func (e *docker) WaitStep(ctx context.Context, step *backend_types.Step, taskUUI return nil, err } + exitCode := info.Container.State.ExitCode + // Windows Docker may return 4294967295 (uint32 max, i.e. int32(-1)) for abnormal exits. + if exitCode == int(^uint32(0)) { + exitCode = int(int32(exitCode)) + } + return &backend_types.State{ Exited: true, - ExitCode: info.Container.State.ExitCode, + ExitCode: exitCode, OOMKilled: info.Container.State.OOMKilled, }, nil }