summaryrefslogtreecommitdiff
path: root/lib/tty.js
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2012-12-12 22:06:35 -0800
committerisaacs <i@izs.me>2012-12-14 10:52:30 -0800
commitbb56dcc4505f1b8fe7fe5d9f975a96510787f2a7 (patch)
tree7c65560840cea29f3dd7fe567bbbdc834874f3b5 /lib/tty.js
parent695abba5ac3365792c17ae3b83ba1272fb34ba5a (diff)
downloadandroid-node-v8-bb56dcc4505f1b8fe7fe5d9f975a96510787f2a7.tar.gz
android-node-v8-bb56dcc4505f1b8fe7fe5d9f975a96510787f2a7.tar.bz2
android-node-v8-bb56dcc4505f1b8fe7fe5d9f975a96510787f2a7.zip
tty/stdin: Refactor for streams2
Diffstat (limited to 'lib/tty.js')
-rw-r--r--lib/tty.js35
1 files changed, 20 insertions, 15 deletions
diff --git a/lib/tty.js b/lib/tty.js
index 9fa18fd38c..5b4036d0db 100644
--- a/lib/tty.js
+++ b/lib/tty.js
@@ -40,42 +40,47 @@ exports.setRawMode = util.deprecate(function(flag) {
}, 'tty.setRawMode: Use `process.stdin.setRawMode()` instead.');
-function ReadStream(fd) {
- if (!(this instanceof ReadStream)) return new ReadStream(fd);
- net.Socket.call(this, {
+function ReadStream(fd, options) {
+ if (!(this instanceof ReadStream))
+ return new ReadStream(fd, options);
+
+ options = util._extend({
+ highWaterMark: 0,
+ lowWaterMark: 0,
handle: new TTY(fd, true)
- });
+ }, options);
+
+ net.Socket.call(this, options);
this.readable = true;
this.writable = false;
this.isRaw = false;
+ this.isTTY = true;
+
+ // this.read = function(orig) { return function(n) {
+ // var ret = orig.apply(this, arguments);
+ // console.trace('TTY read(' + n + ') -> ' + ret);
+ // return ret;
+ // } }(this.read);
}
inherits(ReadStream, net.Socket);
exports.ReadStream = ReadStream;
-ReadStream.prototype.pause = function() {
- return net.Socket.prototype.pause.call(this);
-};
-
-ReadStream.prototype.resume = function() {
- return net.Socket.prototype.resume.call(this);
-};
-
ReadStream.prototype.setRawMode = function(flag) {
flag = !!flag;
this._handle.setRawMode(flag);
this.isRaw = flag;
};
-ReadStream.prototype.isTTY = true;
-
function WriteStream(fd) {
if (!(this instanceof WriteStream)) return new WriteStream(fd);
net.Socket.call(this, {
- handle: new TTY(fd, false)
+ handle: new TTY(fd, false),
+ readable: false,
+ writable: true
});
this.readable = false;