Skip to content

module: do not use process.exit() - #25769

Closed
addaleax wants to merge 3 commits into
nodejs:masterfrom
addaleax:esm-no-process-exit
Closed

module: do not use process.exit()#25769
addaleax wants to merge 3 commits into
nodejs:masterfrom
addaleax:esm-no-process-exit

Conversation

@addaleax

@addaleaxaddaleax commented Jan 28, 2019

Copy link
Copy Markdown
Member

module: silence ModuleJob unhandled rejection warnings

This could otherwise print unhandled rejection warnings
if the process does not exit immediately inside an earlier
.catch() handler.

module: do not use process.exit()

Inside workers, using stdio is always asynchronous, so using
process.exit() always interrupts sending of messages to the
parent thread, including error messages presented over stdio.

Do not use process.exit() and instead use the cleaner
process.exitCode directly
trigger a “real” uncaught exception.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

This could otherwise print unhandled rejection warnings
if the process does not exit immediately inside an earlier
`.catch()` handler.
Inside workers, using stdio is always asynchronous, so using
`process.exit()` always interrupts sending of messages to the
parent thread, including error messages presented over stdio.
Do not use `process.exit()` and instead use the cleaner
`process.exitCode` directly.
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@addaleaxaddaleax added the esm Issues and PRs related to the ECMAScript Modules implementation. label Jan 28, 2019
@addaleax

Copy link
Copy Markdown
MemberAuthor

Comment threadlib/internal/modules/cjs/loader.js Outdated
@addaleax

addaleax commented Jan 28, 2019

Copy link
Copy Markdown
MemberAuthor

CI: https://ci.nodejs.org/job/node-test-pull-request/20376/ (:heavy_check_mark:)

@addaleaxaddaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 28, 2019
@addaleax

Copy link
Copy Markdown
MemberAuthor

Landed in 94ebf3f, 7fa5157

@addaleax
addaleax deleted the esm-no-process-exit branch January 30, 2019 17:18
addaleax added a commit that referenced this pull request Jan 30, 2019
This could otherwise print unhandled rejection warnings
if the process does not exit immediately inside an earlier
`.catch()` handler.
PR-URL: #25769
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax added a commit that referenced this pull request Jan 30, 2019
Inside workers, using stdio is always asynchronous, so using
`process.exit()` always interrupts sending of messages to the
parent thread, including error messages presented over stdio.
Do not use `process.exit()` and instead trigger a “real”
uncaught exception.
PR-URL: #25769
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Jan 30, 2019
This could otherwise print unhandled rejection warnings
if the process does not exit immediately inside an earlier
`.catch()` handler.
PR-URL: #25769
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Jan 30, 2019
Inside workers, using stdio is always asynchronous, so using
`process.exit()` always interrupts sending of messages to the
parent thread, including error messages presented over stdio.
Do not use `process.exit()` and instead trigger a “real”
uncaught exception.
PR-URL: #25769
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.esmIssues and PRs related to the ECMAScript Modules implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@addaleax@nodejs-github-bot@jasnell@guybedford@lpinca@targos@cjihrig@devsnek@BridgeAR