@@ -74,8 +74,6 @@ const {
7474 ObjectKeys,
7575 ObjectSetPrototypeOf,
7676 Promise,
77- PromisePrototypeFinally,
78- PromisePrototypeThen,
7977 PromiseRace,
8078 ReflectApply,
8179 RegExp,
@@ -566,21 +564,24 @@ function REPLServer(prompt,
566564 promise = PromiseRace ( [ promise , interrupt ] ) ;
567565 }
568566
569- PromisePrototypeFinally ( PromisePrototypeThen ( promise , ( result ) => {
570- finishExecution ( null , result ) ;
571- } , ( err ) => {
572- if ( err && process . domain ) {
573- debug ( 'not recoverable, send to domain' ) ;
574- process . domain . emit ( 'error' , err ) ;
575- process . domain . exit ( ) ;
576- return ;
567+ ( async ( ) => {
568+ try {
569+ const result = await promise ;
570+ finishExecution ( null , result ) ;
571+ } catch ( err ) {
572+ if ( err && process . domain ) {
573+ debug ( 'not recoverable, send to domain' ) ;
574+ process . domain . emit ( 'error' , err ) ;
575+ process . domain . exit ( ) ;
576+ return ;
577+ }
578+ finishExecution ( err ) ;
579+ } finally {
580+ // Remove prioritized SIGINT listener if it was not called.
581+ prioritizedSigintQueue . delete ( sigintListener ) ;
582+ unpause ( ) ;
577583 }
578- finishExecution ( err ) ;
579- } ) , ( ) => {
580- // Remove prioritized SIGINT listener if it was not called.
581- prioritizedSigintQueue . delete ( sigintListener ) ;
582- unpause ( ) ;
583- } ) ;
584+ } ) ( ) ;
584585 }
585586 }
586587
@@ -768,7 +769,9 @@ function REPLServer(prompt,
768769 const prioritizedSigintQueue = new SafeSet ( ) ;
769770 self . on ( 'SIGINT' , function onSigInt ( ) {
770771 if ( prioritizedSigintQueue . size > 0 ) {
771- ArrayPrototypeForEach ( prioritizedSigintQueue , ( task ) => task ( ) ) ;
772+ for ( const task of prioritizedSigintQueue ) {
773+ task ( ) ;
774+ }
772775 return ;
773776 }
774777
0 commit comments