From 6925bad57bbacc117de3a18c196badeff20e57f5 Mon Sep 17 00:00:00 2001 From: Alexander Mills Date: Wed, 19 Sep 2018 11:09:25 -0700 Subject: [PATCH 1/3] tty: make setRawMode() return this (and updated corresponding docs) --- doc/api/tty.md | 2 +- lib/tty.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/api/tty.md b/doc/api/tty.md index cc95bfa9ae86ba..4babf3d178de98 100644 --- a/doc/api/tty.md +++ b/doc/api/tty.md @@ -63,7 +63,7 @@ added: v0.7.7 * `mode` {boolean} If `true`, configures the `tty.ReadStream` to operate as a 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. + 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) { From c7b469c69e932a38d19d88bc016fbbb152758825 Mon Sep 17 00:00:00 2001 From: Alexander Mills Date: Wed, 19 Sep 2018 12:07:56 -0700 Subject: [PATCH 2/3] tty: make setRawMode() return this (and updated corresponding docs) --- doc/api/tty.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/tty.md b/doc/api/tty.md index 4babf3d178de98..46c98fa987826c 100644 --- a/doc/api/tty.md +++ b/doc/api/tty.md @@ -63,7 +63,9 @@ added: v0.7.7 * `mode` {boolean} If `true`, configures the `tty.ReadStream` to operate as a 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. + mode. + + Returns {this} - the read stream instance. Allows configuration of `tty.ReadStream` so that it operates as a raw device. From 3e027a37bbd17b3bd2b0c8454c42a2102b59b37d Mon Sep 17 00:00:00 2001 From: Operations Research Engineering Software+ Date: Wed, 19 Sep 2018 12:57:45 -0700 Subject: [PATCH 3/3] tty: make setRawMode() return this (and updated corresponding docs) updated docs --- doc/api/tty.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/tty.md b/doc/api/tty.md index 46c98fa987826c..7a788f6fa0f696 100644 --- a/doc/api/tty.md +++ b/doc/api/tty.md @@ -65,7 +65,7 @@ added: v0.7.7 default mode. The `readStream.isRaw` property will be set to the resulting mode. - Returns {this} - the read stream instance. +* Returns {this} - the read stream instance. Allows configuration of `tty.ReadStream` so that it operates as a raw device.