Negative exit codes are reported incorrectly on Windows
MR: https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/6587+s ## Summary When a CI/CD job script returns a negative exit code (such as `exit -1`) on a Windows Runner (Shell (PowerShell) executor and Docker-Windows executor), the Gitlab Runner doesn't know how to handle it and does not report the actual negative value. ### Shell executor example: ``` Running with gitlab-runner 18.9.0 (07e534ba) on Training-Runner-Shell, system ID: s_2c4kk7f4i20b Preparing the "shell" executor using Shell (powershell) executor... Preparing environment Running on COMPUTER... Getting source from Git repository Fetching changes... Initialized empty Git repository in C:/Gitlab-Runner/builds/a5EUQebEt/0/pishel65/example/.git/ Created fresh repository. Checking out 25bd9bec as detached HEAD (ref is Check-Exit-Code)... git-lfs/3.7.1 (GitHub; windows amd64; go 1.25.1; git b84b3384) Skipping Git submodules setup Executing "step_script" stage of the job script $ exit -1 Cleaning up project directory and file based variables ERROR: Job failed: exit status 0xffffffff ``` ### Docker-Windows executor example: ``` Running with gitlab-runner 18.9.0 (07e534ba) on Training-Docker-Runner, system ID: s_2c7767j67820b Preparing the "docker" executor Using default image Using Docker executor with image mcr.microsoft.com/windows/servercore:ltsc2025 ... Using helper image: gitlab/gitlab-runner-helper:x86_64-v18.9.0-servercore21H2 Using effective pull policy of [always] for container gitlab/gitlab-runner-helper:x86_64-v18.9.0-servercore21H2 Pulling docker image gitlab/gitlab-runner-helper:x86_64-v18.9.0-servercore21H2 ... Using docker image sha256:b00afc7d1d1641b8bf6e12334cf7f65cad5e0b3d67cd81b0c4ece3df949bdb78 for gitlab/gitlab-runner-helper:x86_64-v18.9.0-servercore21H2 with digest gitlab/gitlab-runner-helper@sha256:58b6ead8a5bc57df4f081764377be8f9b1a7f9c52bee448f951c792abb0af8db ... Using default image Using effective pull policy of [always] for container mcr.microsoft.com/windows/servercore:ltsc2025 Pulling docker image mcr.microsoft.com/windows/servercore:ltsc2025 ... Using docker image sha256:bb05ce194d375b44e101416dcb49acbde82caddd7bc69285744f919094561d7a for mcr.microsoft.com/windows/servercore:ltsc2025 with digest mcr.microsoft.com/windows/servercore@sha256:79aa6a176b2e4f1786eb29c4facd33077769eddde4c4a650aea552f6320893c7 ... Preparing environment 00:05 Using helper image: gitlab/gitlab-runner-helper:x86_64-v18.9.0-servercore21H2 Using effective pull policy of [always] for container gitlab/gitlab-runner-helper:x86_64-v18.9.0-servercore21H2 Using docker image gitlab/gitlab-runner-helper:x86_64-v18.9.0-servercore21H2 Getting source from Git repository Fetching changes... Initialized empty Git repository in C:/builds/pishel65/example/.git/ Created fresh repository. Checking out 25bd9bec as detached HEAD (ref is Check-Exit-Code)... git-lfs/3.7.1 (GitHub; windows amd64; go 1.25.1; git b84b3384) Skipping Git submodules setup Executing "step_script" stage of the job script Using default image Using effective pull policy of [always] for container mcr.microsoft.com/windows/servercore:ltsc2025 Using docker image sha256:bb05ce194d375b44e101416dcb49acbde82caddd7bc69285744f919094561d7a for mcr.microsoft.com/windows/servercore:ltsc2025 with digest mcr.microsoft.com/windows/servercore@sha256:79aa6a176b2e4f1786eb29c4facd33077769eddde4c4a650aea552f6320893c7 ... $ exit -1 Cleaning up project directory and file based variables ERROR: Job failed: exit code 4294967295 ``` This behavior is unexpected and causes issues when users try to utilize `allow_failure:exit_codes` and `retry:exit_codes`
issue