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 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.