Revert "tty: don't read from console stream upon creation"

This reverts commit 4611389294.

The offending commit broke certain usages of piping from stdin.

Fixes: https://github.com/nodejs/node/issues/5927
PR-URL: https://github.com/nodejs/node/pull/5947
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Alexis Campailla <orangemocha@nodejs.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Evan Lucas 2016-03-29 08:09:37 -05:00
parent 89abe86808
commit b6475b9a9d

View File

@ -17,23 +17,17 @@ function ReadStream(fd, options) {
if (!(this instanceof ReadStream))
return new ReadStream(fd, options);
// pauseOnCreate to avoid reading from the sytem buffer
options = util._extend({
highWaterMark: 0,
readable: true,
writable: false,
handle: new TTY(fd, true),
pauseOnCreate: true
handle: new TTY(fd, true)
}, options);
net.Socket.call(this, options);
this.isRaw = false;
this.isTTY = true;
// Let the stream resume automatically when 'data' event handlers
// are added, even though it was paused on creation
this._readableState.flowing = null;
}
inherits(ReadStream, net.Socket);