mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-28 20:47:01 +00:00
Update pipe-ipc.js
This commit is contained in:
parent
c189a940e5
commit
ee91c564dc
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user