|
|
@ -17,19 +17,6 @@ exports.createInterface = function(output, completer) { |
|
|
|
return new Interface(output, completer); |
|
|
|
}; |
|
|
|
|
|
|
|
function writeFilter(stream) { |
|
|
|
if (stream._writeFiltered) return; |
|
|
|
stream._writeFiltered = true; |
|
|
|
stream._normalWrite = stream.write; |
|
|
|
stream.write = function(d) { |
|
|
|
var args = Array.prototype.slice.call(arguments); |
|
|
|
if (typeof d == 'string') { |
|
|
|
args[0] = d.replace(/([^\r])\n|^\n/g, '$1\r\n'); |
|
|
|
} |
|
|
|
// TODO what about buffers?
|
|
|
|
return stream._normalWrite.apply(stream, args); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function Interface(output, completer) { |
|
|
|
if (!(this instanceof Interface)) return new Interface(output, completer); |
|
|
@ -49,9 +36,6 @@ function Interface(output, completer) { |
|
|
|
if (this.enabled) { |
|
|
|
// input refers to stdin
|
|
|
|
|
|
|
|
writeFilter(this.output); |
|
|
|
writeFilter(process.stdout); |
|
|
|
|
|
|
|
// Current line
|
|
|
|
this.line = ''; |
|
|
|
|
|
|
|