diff --git a/lib/readline.js b/lib/readline.js index 1793cb21264df1..38ddebaa4917ca 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -117,6 +117,7 @@ const kMincrlfDelay = 100; const lineEnding = /\r?\n|\r(?!\n)/; const kLineObjectStream = Symbol('line object stream'); +const kQuestionCancel = Symbol('kQuestionCancel'); const KEYPRESS_DECODER = Symbol('keypress-decoder'); const ESCAPE_DECODER = Symbol('escape-decoder'); @@ -225,7 +226,7 @@ function Interface(input, output, completer, terminal) { }; } - this._questionCancel = FunctionPrototypeBind(_questionCancel, this); + this[kQuestionCancel] = FunctionPrototypeBind(_questionCancel, this); this.setPrompt(prompt); @@ -368,7 +369,7 @@ Interface.prototype.question = function(query, options, cb) { if (options.signal) { options.signal.addEventListener('abort', () => { - this._questionCancel(); + this[kQuestionCancel](); }, { once: true }); }