Skip to content

Commit

Permalink
tty: make readStream.setRawMode() return this
Browse files Browse the repository at this point in the history
PR-URL: #22950
Fixes: #22916
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
  • Loading branch information
ORESoftware authored and targos committed Sep 23, 2018
1 parent 43e3cf9 commit 9c36827
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 @@ -66,9 +66,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 9c36827

Please sign in to comment.