Skip to content

fix: correct utility process exit code on Windows#50386

Merged
dsanders11 merged 2 commits into
41-x-yfrom
trop/41-x-y-bp-fix-correct-utility-process-exit-code-on-windows-1773953903839
Mar 20, 2026
Merged

fix: correct utility process exit code on Windows#50386
dsanders11 merged 2 commits into
41-x-yfrom
trop/41-x-y-bp-fix-correct-utility-process-exit-code-on-windows-1773953903839

Conversation

@trop

@trop trop Bot commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Backport of #50256

See that PR for details.

Notes: Fixed utilityProcess exit event reporting incorrect exit codes on Windows when the exit code has the high bit

trop Bot and others added 2 commits March 19, 2026 20:58
On Windows, process exit codes are 32-bit unsigned integers (DWORD).
When passed from Chromium to Electron as a signed int and then
implicitly converted to uint64_t, values with the high bit set
(e.g., NTSTATUS codes) undergo sign extension, producing incorrect
values.

Cast the exit code to uint32_t before widening to uint64_t to
prevent sign extension and preserve the original Windows exit code.

Fixes #49455

Co-authored-by: João Silva <[email protected]>
@trop trop Bot requested a review from a team March 19, 2026 20:58
@trop trop Bot added 41-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Mar 19, 2026
@dsanders11 dsanders11 merged commit 43bb939 into 41-x-y Mar 20, 2026
115 of 116 checks passed
@dsanders11 dsanders11 deleted the trop/41-x-y-bp-fix-correct-utility-process-exit-code-on-windows-1773953903839 branch March 20, 2026 01:48
@release-clerk

release-clerk Bot commented Mar 20, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed utilityProcess exit event reporting incorrect exit codes on Windows when the exit code has the high bit

gregpriday added a commit to daintreehq/daintree that referenced this pull request May 20, 2026
- workspace-host: add setImmediate(() => process.exit(1)) to both fatal
  handlers, matching pty-host symmetry. Electron 37+ no longer crashes
  utility processes on unhandledRejection; without explicit exit the
  parent's child-process-gone supervision path never fires.
- PtyHostLifecycle and WorkspaceHostProcess: update stale comments to
  reference electron/electron#50386 (Windows exit-code mangling, fixed
  in 41.0.4) and #42283 (exit/child-process-gone ordering race).
  Defense-in-depth code preserved.
- Add scripts/ci/check-crash-loop-constants.mjs to assert the three
  crash-loop constants stay equal across both host lifecycle files.
  Wired into npm run check. The constants remain duplicated by design.

Closes #8698
gregpriday added a commit to daintreehq/daintree that referenced this pull request May 20, 2026
- workspace-host: add setImmediate(() => process.exit(1)) to both fatal
  handlers, matching pty-host symmetry. Electron 37+ no longer crashes
  utility processes on unhandledRejection; without explicit exit the
  parent's child-process-gone supervision path never fires.
- PtyHostLifecycle and WorkspaceHostProcess: update stale comments to
  reference electron/electron#50386 (Windows exit-code mangling, fixed
  in 41.0.4) and #42283 (exit/child-process-gone ordering race).
  Defense-in-depth code preserved.
- Add scripts/ci/check-crash-loop-constants.mjs to assert the three
  crash-loop constants stay equal across both host lifecycle files.
  Wired into npm run check. The constants remain duplicated by design.

Closes #8698
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

41-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant