@@ -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,
@@ -566,21 +564,24 @@ function REPLServer(prompt,
566
564
promise = PromiseRace ( [ promise , interrupt ] ) ;
567
565
}
568
566
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 ( ) ;
577
583
}
578
- finishExecution ( err ) ;
579
- } ) , ( ) => {
580
- // Remove prioritized SIGINT listener if it was not called.
581
- prioritizedSigintQueue . delete ( sigintListener ) ;
582
- unpause ( ) ;
583
- } ) ;
584
+ } ) ( ) ;
584
585
}
585
586
}
586
587
@@ -768,7 +769,9 @@ function REPLServer(prompt,
768
769
const prioritizedSigintQueue = new SafeSet ( ) ;
769
770
self . on ( 'SIGINT' , function onSigInt ( ) {
770
771
if ( prioritizedSigintQueue . size > 0 ) {
771
- ArrayPrototypeForEach ( prioritizedSigintQueue , ( task ) => task ( ) ) ;
772
+ for ( const task of prioritizedSigintQueue ) {
773
+ task ( ) ;
774
+ }
772
775
return ;
773
776
}
774
777
0 commit comments