diff --git a/doc/api/tty.md b/doc/api/tty.md index cc95bfa9ae86ba..45b66abb9e832d 100644 --- a/doc/api/tty.md +++ b/doc/api/tty.md @@ -64,6 +64,7 @@ added: v0.7.7 raw device. If `false`, configures the `tty.ReadStream` to operate in its default mode. The `readStream.isRaw` property will be set to the resulting mode. +* Returns: {this} - the read stream instance. Allows configuration of `tty.ReadStream` so that it operates as a raw device. diff --git a/lib/tty.js b/lib/tty.js index 4e78347c2d25ba..3cc2320e9695f1 100644 --- a/lib/tty.js +++ b/lib/tty.js @@ -71,9 +71,10 @@ ReadStream.prototype.setRawMode = function(flag) { const err = this._handle.setRawMode(flag); if (err) { this.emit('error', errors.errnoException(err, 'setRawMode')); - return; + return this; } this.isRaw = flag; + return this; }; function WriteStream(fd) {