diff --git a/lib/tty.js b/lib/tty.js index 62eb8719b114b9..4e78347c2d25ba 100644 --- a/lib/tty.js +++ b/lib/tty.js @@ -68,7 +68,11 @@ inherits(ReadStream, net.Socket); ReadStream.prototype.setRawMode = function(flag) { flag = !!flag; - this._handle.setRawMode(flag); + const err = this._handle.setRawMode(flag); + if (err) { + this.emit('error', errors.errnoException(err, 'setRawMode')); + return; + } this.isRaw = flag; };