Use streams for stdout and stdin

This commit is contained in:
Ryan Dahl 2010-03-15 15:11:40 -07:00
parent cbfd4da818
commit fdf46a65c9
8 changed files with 76 additions and 186 deletions

View file

@ -2,23 +2,23 @@ var events = require('events');
exports.print = function () {
for (var i = 0, len = arguments.length; i < len; ++i) {
process.stdio.write(arguments[i]);
process.stdout.write(arguments[i]);
}
};
exports.puts = function () {
for (var i = 0, len = arguments.length; i < len; ++i) {
process.stdio.write(arguments[i] + '\n');
process.stdout.write(arguments[i] + '\n');
}
};
exports.debug = function (x) {
process.stdio.writeError("DEBUG: " + x + "\n");
process.binding('stdio').writeError("DEBUG: " + x + "\n");
};
exports.error = function (x) {
for (var i = 0, len = arguments.length; i < len; ++i) {
process.stdio.writeError(arguments[i] + '\n');
process.binding('stdio').writeError(arguments[i] + '\n');
}
};