Skip to content

Commit fec093b

Browse files
cjihrigLxxyx
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 b02030d commit fec093b

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

@@ -376,7 +377,7 @@ Interface.prototype.question = function(query, options, cb) {
376377

377378
if (options.signal) {
378379
options.signal.addEventListener('abort', () => {
379-
this._questionCancel();
380+
this[kQuestionCancel]();
380381
}, { once: true });
381382
}
382383

0 commit comments

Comments
 (0)