mirror of
https://github.com/nodejs/node.git
synced 2025-05-22 15:55:37 +00:00

PR-URL: https://github.com/nodejs/node/pull/49523 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
17 lines
432 B
JavaScript
17 lines
432 B
JavaScript
'use strict';
|
|
|
|
const { exitCodes: { kUnfinishedTopLevelAwait } } = internalBinding('errors');
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
function handleProcessExit() {
|
|
process.exitCode ??= kUnfinishedTopLevelAwait;
|
|
}
|
|
|
|
module.exports = {
|
|
handleProcessExit,
|
|
};
|