diff --git a/lib/pipe-ipc.js b/lib/pipe-ipc.js index 862a06c..4eef876 100644 --- a/lib/pipe-ipc.js +++ b/lib/pipe-ipc.js @@ -46,7 +46,6 @@ function PipeIPC() { this._write = function(message) { this.writer.Write(message); - this.writer.Write("\r\n"); }; this.write = function(message) { @@ -64,28 +63,7 @@ function PipeIPC() { } } }; - - this._read = function() { - return this.reader.ReadAll().split(/\r?\n/); - }; - - this.read = function() { - var isRead = false; - var messages = []; - - while (!isRead) { - try { - messages = this._read(); - isRead = true; - } catch (e) { - this.closeReader(); - this.createReader(); - } - } - - return messages; - }; - + this.flush = function() { var isFlushed = false; @@ -101,8 +79,25 @@ function PipeIPC() { } }; - this.readText = function() { - return this.read().join(' '); + this._read = function() { + return this.reader.ReadAll(); + }; + + this.read = function() { + var isRead = false; + var text = ""; + + while (!isRead) { + try { + text += this._read(); + isRead = true; + } catch (e) { + this.closeReader(); + this.createReader(); + } + } + + return text; }; this.close = function() {