Skip to content

Commit 1714998

Browse files
cjihrigtargos
authored andcommitted
readline: replace _questionCancel with a symbol
This commit avoids exposing a new underscored property on readline Interface instances. PR-URL: #37094 Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 3d64d2b commit 1714998

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/readline.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ const kMincrlfDelay = 100;
117117
const lineEnding = /\r?\n|\r(?!\n)/;
118118

119119
const kLineObjectStream = Symbol('line object stream');
120+
const kQuestionCancel = Symbol('kQuestionCancel');
120121

121122
const KEYPRESS_DECODER = Symbol('keypress-decoder');
122123
const ESCAPE_DECODER = Symbol('escape-decoder');
@@ -225,7 +226,7 @@ function Interface(input, output, completer, terminal) {
225226
};
226227
}
227228

228-
this._questionCancel = FunctionPrototypeBind(_questionCancel, this);
229+
this[kQuestionCancel] = FunctionPrototypeBind(_questionCancel, this);
229230

230231
this.setPrompt(prompt);
231232

@@ -368,7 +369,7 @@ Interface.prototype.question = function(query, options, cb) {
368369

369370
if (options.signal) {
370371
options.signal.addEventListener('abort', () => {
371-
this._questionCancel();
372+
this[kQuestionCancel]();
372373
}, { once: true });
373374
}
374375

0 commit comments

Comments
 (0)