Skip to content

Commit

Permalink
move comment to handle_process_exit file
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonBall committed Jan 4, 2022
1 parent d58b5b9 commit d7bb21f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lib/internal/modules/esm/handle_process_exit.js
@@ -1,5 +1,9 @@
'use strict';

// Handle a Promise from running code that potentially does Top-Level Await.
// In that case, it makes sense to set the exit code to a specific non-zero
// value if the main code never finishes running.
// The original purpose was https://github.com/nodejs/node/pull/34640
function handleProcessExit() {
process.exitCode ??= 13;
}
Expand Down
3 changes: 0 additions & 3 deletions lib/internal/modules/run_main.js
Expand Up @@ -56,9 +56,6 @@ function runMainESM(mainPath) {
}

async function handleMainPromise(promise) {
// Handle a Promise from running code that potentially does Top-Level Await.
// In that case, it makes sense to set the exit code to a specific non-zero
// value if the main code never finishes running.
process.on('exit', handleProcessExit);
try {
return await promise;
Expand Down

0 comments on commit d7bb21f

Please sign in to comment.