repl: use promise#finally
PR-URL: https://github.com/nodejs/node/pull/23971 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
parent
7825045ee6
commit
c1e670338b
14
lib/repl.js
14
lib/repl.js
@ -376,18 +376,8 @@ function REPLServer(prompt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
promise.then((result) => {
|
promise.then((result) => {
|
||||||
// Remove prioritized SIGINT listener if it was not called.
|
|
||||||
// TODO(TimothyGu): Use Promise.prototype.finally when it becomes
|
|
||||||
// available.
|
|
||||||
prioritizedSigintQueue.delete(sigintListener);
|
|
||||||
|
|
||||||
finishExecution(undefined, result);
|
finishExecution(undefined, result);
|
||||||
unpause();
|
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
// Remove prioritized SIGINT listener if it was not called.
|
|
||||||
prioritizedSigintQueue.delete(sigintListener);
|
|
||||||
|
|
||||||
unpause();
|
|
||||||
if (err && process.domain) {
|
if (err && process.domain) {
|
||||||
debug('not recoverable, send to domain');
|
debug('not recoverable, send to domain');
|
||||||
process.domain.emit('error', err);
|
process.domain.emit('error', err);
|
||||||
@ -395,6 +385,10 @@ function REPLServer(prompt,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
finishExecution(err);
|
finishExecution(err);
|
||||||
|
}).finally(() => {
|
||||||
|
// Remove prioritized SIGINT listener if it was not called.
|
||||||
|
prioritizedSigintQueue.delete(sigintListener);
|
||||||
|
unpause();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user