mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
readline: fix question still called after closed
resolve: https://github.com/nodejs/node/issues/42450 PR-URL: https://github.com/nodejs/node/pull/42464 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
parent
0bac5478eb
commit
d36b60e69a
6 changed files with 73 additions and 1 deletions
|
@ -38,7 +38,10 @@ const {
|
|||
|
||||
const { codes } = require('internal/errors');
|
||||
|
||||
const { ERR_INVALID_ARG_VALUE } = codes;
|
||||
const {
|
||||
ERR_INVALID_ARG_VALUE,
|
||||
ERR_USE_AFTER_CLOSE,
|
||||
} = codes;
|
||||
const {
|
||||
validateAbortSignal,
|
||||
validateArray,
|
||||
|
@ -398,6 +401,9 @@ class Interface extends InterfaceConstructor {
|
|||
}
|
||||
|
||||
question(query, cb) {
|
||||
if (this.closed) {
|
||||
throw new ERR_USE_AFTER_CLOSE('readline');
|
||||
}
|
||||
if (this[kQuestionCallback]) {
|
||||
this.prompt();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue