From 72d659a000917e848f49c81e63ee2b0524b73de0 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 8 May 2016 03:29:43 +0200 Subject: [PATCH] readline: return old status from _setRawMode Return the previous raw mode setting from the internal `_setRawMode` so that is easier to reset it to its original state later. PR-URL: https://github.com/nodejs/node/pull/6635 Reviewed-By: Ben Noordhuis --- lib/readline.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/readline.js b/lib/readline.js index cd78b75ac31454..46982bca5feaa8 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -183,9 +183,13 @@ Interface.prototype.setPrompt = function(prompt) { Interface.prototype._setRawMode = function(mode) { + const wasInRawMode = this.input.isRaw; + if (typeof this.input.setRawMode === 'function') { - return this.input.setRawMode(mode); + this.input.setRawMode(mode); } + + return wasInRawMode; };