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 <info@bnoordhuis.nl>
This commit is contained in:
Anna Henningsen 2016-05-08 03:29:43 +02:00
parent 0815b9401d
commit dc57b9e78f
No known key found for this signature in database
GPG Key ID: D8B9F5AEAE84E4CF

View File

@ -182,9 +182,13 @@ Interface.prototype.setPrompt = function(prompt) {
Interface.prototype._setRawMode = function(mode) { Interface.prototype._setRawMode = function(mode) {
const wasInRawMode = this.input.isRaw;
if (typeof this.input.setRawMode === 'function') { if (typeof this.input.setRawMode === 'function') {
return this.input.setRawMode(mode); this.input.setRawMode(mode);
} }
return wasInRawMode;
}; };