File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,21 +49,14 @@ function runMainESM(mainPath) {
4949
5050function handleMainPromise ( promise ) {
5151 // Handle a Promise from running code that potentially does Top-Level Await.
52- // In that case, it makes sense to:
53- // - Treat a rejection as an unhandled exception
54- // - Set the exit code to a specific non-zero value if the main code never
55- // finishes running.
52+ // In that case, it makes sense to set the exit code to a specific non-zero
53+ // value if the main code never finishes running.
5654 function handler ( ) {
5755 if ( process . exitCode === undefined )
5856 process . exitCode = 13 ;
5957 }
6058 process . on ( 'exit' , handler ) ;
61- promise
62- . finally ( ( ) => process . off ( 'exit' , handler ) )
63- . catch ( ( err ) => {
64- internalBinding ( 'errors' ) . triggerUncaughtException (
65- err , true /* fromPromise */ ) ;
66- } ) ;
59+ return promise . finally ( ( ) => process . off ( 'exit' , handler ) ) ;
6760}
6861
6962// For backwards compatibility, we have to run a bunch of
You can’t perform that action at this time.
0 commit comments