mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-11-29 10:53:43 +00:00
Update pipe-ipc.js
This commit is contained in:
parent
3294e23e59
commit
1ed17cc5c0
|
|
@ -44,13 +44,17 @@ function PipeIPC() {
|
||||||
this.reader = null;
|
this.reader = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this._write = function(message) {
|
||||||
|
this.writer.Write(message);
|
||||||
|
};
|
||||||
|
|
||||||
this.write = function(message) {
|
this.write = function(message) {
|
||||||
var isWritten = false;
|
var isWritten = false;
|
||||||
|
|
||||||
while (!isWritten) {
|
while (!isWritten) {
|
||||||
try {
|
try {
|
||||||
this.createWriter();
|
this.createWriter();
|
||||||
this.writer.Write(message);
|
this._write(message);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
this.writer.Close();
|
this.writer.Close();
|
||||||
isWritten = true;
|
isWritten = true;
|
||||||
|
|
@ -59,6 +63,10 @@ function PipeIPC() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this._read = function() {
|
||||||
|
return this.reader.ReadAll();
|
||||||
|
};
|
||||||
|
|
||||||
this.read = function() {
|
this.read = function() {
|
||||||
var isRead = false;
|
var isRead = false;
|
||||||
|
|
@ -66,7 +74,7 @@ function PipeIPC() {
|
||||||
|
|
||||||
while (!isRead) {
|
while (!isRead) {
|
||||||
try {
|
try {
|
||||||
text = this.reader.ReadAll();
|
text = this._read();
|
||||||
isRead = true;
|
isRead = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.closeReader();
|
this.closeReader();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user