@@ -74,8 +74,6 @@ const {
7474 ObjectKeys,
7575 ObjectSetPrototypeOf,
7676 Promise,
77- PromisePrototypeFinally,
78- PromisePrototypeThen,
7977 PromiseRace,
8078 ReflectApply,
8179 RegExp,
@@ -571,21 +569,24 @@ function REPLServer(prompt,
571569 promise = PromiseRace ( [ promise , interrupt ] ) ;
572570 }
573571
574- PromisePrototypeFinally ( PromisePrototypeThen ( promise , ( result ) => {
575- finishExecution ( null , result ) ;
576- } , ( err ) => {
577- if ( err && process . domain ) {
578- debug ( 'not recoverable, send to domain' ) ;
579- process . domain . emit ( 'error' , err ) ;
580- process . domain . exit ( ) ;
581- return ;
572+ ( async ( ) => {
573+ try {
574+ const result = await promise ;
575+ finishExecution ( null , result ) ;
576+ } catch ( err ) {
577+ if ( err && process . domain ) {
578+ debug ( 'not recoverable, send to domain' ) ;
579+ process . domain . emit ( 'error' , err ) ;
580+ process . domain . exit ( ) ;
581+ return ;
582+ }
583+ finishExecution ( err ) ;
584+ } finally {
585+ // Remove prioritized SIGINT listener if it was not called.
586+ prioritizedSigintQueue . delete ( sigintListener ) ;
587+ unpause ( ) ;
582588 }
583- finishExecution ( err ) ;
584- } ) , ( ) => {
585- // Remove prioritized SIGINT listener if it was not called.
586- prioritizedSigintQueue . delete ( sigintListener ) ;
587- unpause ( ) ;
588- } ) ;
589+ } ) ( ) ;
589590 }
590591 }
591592
@@ -789,7 +790,9 @@ function REPLServer(prompt,
789790 const prioritizedSigintQueue = new SafeSet ( ) ;
790791 self . on ( 'SIGINT' , function onSigInt ( ) {
791792 if ( prioritizedSigintQueue . size > 0 ) {
792- ArrayPrototypeForEach ( prioritizedSigintQueue , ( task ) => task ( ) ) ;
793+ for ( const task of prioritizedSigintQueue ) {
794+ task ( ) ;
795+ }
793796 return ;
794797 }
795798
0 commit comments