Skip to content

Commit cdf4112

Browse files
starkwangcodebytere
authored andcommitted
repl: use promise#finally
PR-URL: #23971 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 6918f1a commit cdf4112

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

lib/repl.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -374,25 +374,19 @@ function REPLServer(prompt,
374374
}
375375

376376
promise.then((result) => {
377-
// Remove prioritized SIGINT listener if it was not called.
378-
// TODO(TimothyGu): Use Promise.prototype.finally when it becomes
379-
// available.
380-
prioritizedSigintQueue.delete(sigintListener);
381-
382377
finishExecution(undefined, result);
383-
unpause();
384378
}, (err) => {
385-
// Remove prioritized SIGINT listener if it was not called.
386-
prioritizedSigintQueue.delete(sigintListener);
387-
388-
unpause();
389379
if (err && process.domain) {
390380
debug('not recoverable, send to domain');
391381
process.domain.emit('error', err);
392382
process.domain.exit();
393383
return;
394384
}
395385
finishExecution(err);
386+
}).finally(() => {
387+
// Remove prioritized SIGINT listener if it was not called.
388+
prioritizedSigintQueue.delete(sigintListener);
389+
unpause();
396390
});
397391
}
398392
}

0 commit comments

Comments
 (0)