diff --git a/lib/tty.js b/lib/tty.js index 33e7c26f0291ed..219008b1086d74 100644 --- a/lib/tty.js +++ b/lib/tty.js @@ -72,7 +72,7 @@ ObjectSetPrototypeOf(ReadStream, net.Socket); ReadStream.prototype.setRawMode = function(flag) { flag = !!flag; - const err = this._handle.setRawMode(flag); + const err = this._handle && this._handle.setRawMode(flag); if (err) { this.emit('error', errors.errnoException(err, 'setRawMode')); return this;