Skip to content

Commit

Permalink
tty: make readStream.setRawMode() return this
Browse files Browse the repository at this point in the history
PR-URL: nodejs#22950
Fixes: nodejs#22916
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Denys Otrishko <[email protected]>
  • Loading branch information
ORESoftware authored and vsemozhetbyt committed Sep 22, 2018
1 parent 2b29df7 commit 1f4d4c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/api/tty.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
3 changes: 2 additions & 1 deletion lib/tty.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1f4d4c0

Please sign in to comment.