#51428: fix: align process.exit() behavior in main process with Node.js
Description of Change
Fixes #27893
The process.exit implementation in the main process is not aligned with upstream behavior from Node.js, most notably around process.exit() not using process.exitCode, and also around taking values as strings.
Adds test coverage for these and a few other test cases. Ideally we'd run Node.js' upstream tests for process.exit to ensure alignment, but ran into a few issues with those tests, so I'll pursue that later.
There's a minor unrelated change where I noticed there were two different describe blocks in the tests for process.stdout so I consolidated them.
Checklist
- I have built and tested this change
- I have filled out the PR description
- I have reviewed and verified the changes
-
npm testpasses - tests are changed or added
- relevant API documentation, tutorials, and examples are updated and follow the documentation style guide
- PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, and past tense.
Release Notes
Notes:
- Fixed an issue with the main process where
process.exit()with no argument did not exit withprocess.exitCode - Fixed handling of string value arguments to
process.exit()in the main process
Backports
No Backports Requested
This pull request doesn't have any backports requested or created for older release branches.
What are backports?
Backports are copies of changes made to the main branch that are applied to older release branches. They ensure that bug fixes and important changes are available in maintained older versions of Electron.
Semver Impact
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron