summaryrefslogtreecommitdiff
path: root/lib/tty.js
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2011-01-19 04:08:07 +0100
committerRyan Dahl <ry@tinyclouds.org>2011-01-18 23:22:38 -0800
commit87d898929ff18a5167ecaec32446bd64b0b07750 (patch)
tree73c133093c0b59fbf2e5c20ff7731dabe5996529 /lib/tty.js
parent4fddca09f115db89f526f1c12744fd40ce31e1ec (diff)
downloadnode-87d898929ff18a5167ecaec32446bd64b0b07750.tar.gz
Implement tty.ReadStream and tty.WriteStream
Diffstat (limited to 'lib/tty.js')
-rw-r--r--lib/tty.js37
1 files changed, 6 insertions, 31 deletions
diff --git a/lib/tty.js b/lib/tty.js
index 5cdd088e8..cba637220 100644
--- a/lib/tty.js
+++ b/lib/tty.js
@@ -1,38 +1,13 @@
-var spawn = require('child_process').spawn;
+
var binding = process.binding('stdio');
+if (process.platform === 'win32') {
+ exports = module.exports = require('tty_win32');
+} else {
+ exports = module.exports = require('tty_posix');
+}
exports.isatty = binding.isatty;
exports.setRawMode = binding.setRawMode;
exports.getWindowSize = binding.getWindowSize;
exports.setWindowSize = binding.setWindowSize;
-
-
-exports.open = function(path, args) {
- var fds = binding.openpty();
-
- var slaveFD = fds[0];
- var masterFD = fds[1];
-
- var env = { TERM: 'vt100' };
- for (var k in process.env) {
- env[k] = process.env[k];
- }
-
- var stream = require('net').Stream(slaveFD);
- stream.readable = stream.writable = true;
- stream.resume();
-
-
- child = spawn(path, args, {
- env: env,
- customFds: [masterFD, masterFD, masterFD],
- setuid: true
- });
-
- return [stream, child];
-};
-
-
-
-