@@ -74,8 +74,6 @@ const {
74
74
ObjectKeys,
75
75
ObjectSetPrototypeOf,
76
76
Promise,
77
- PromisePrototypeFinally,
78
- PromisePrototypeThen,
79
77
PromiseRace,
80
78
ReflectApply,
81
79
RegExp,
@@ -571,21 +569,24 @@ function REPLServer(prompt,
571
569
promise = PromiseRace ( [ promise , interrupt ] ) ;
572
570
}
573
571
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 ( ) ;
582
588
}
583
- finishExecution ( err ) ;
584
- } ) , ( ) => {
585
- // Remove prioritized SIGINT listener if it was not called.
586
- prioritizedSigintQueue . delete ( sigintListener ) ;
587
- unpause ( ) ;
588
- } ) ;
589
+ } ) ( ) ;
589
590
}
590
591
}
591
592
@@ -789,7 +790,9 @@ function REPLServer(prompt,
789
790
const prioritizedSigintQueue = new SafeSet ( ) ;
790
791
self . on ( 'SIGINT' , function onSigInt ( ) {
791
792
if ( prioritizedSigintQueue . size > 0 ) {
792
- ArrayPrototypeForEach ( prioritizedSigintQueue , ( task ) => task ( ) ) ;
793
+ for ( const task of prioritizedSigintQueue ) {
794
+ task ( ) ;
795
+ }
793
796
return ;
794
797
}
795
798
0 commit comments