Update pipe-ipc.js

This commit is contained in:
Namhyeon Go 2022-09-27 18:35:25 +09:00 committed by GitHub
parent 3294e23e59
commit 1ed17cc5c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,13 +44,17 @@ function PipeIPC() {
this.reader = null;
};
this._write = function(message) {
this.writer.Write(message);
};
this.write = function(message) {
var isWritten = false;
while (!isWritten) {
try {
this.createWriter();
this.writer.Write(message);
this._write(message);
sleep(1);
this.writer.Close();
isWritten = true;
@ -59,6 +63,10 @@ function PipeIPC() {
}
}
};
this._read = function() {
return this.reader.ReadAll();
};
this.read = function() {
var isRead = false;
@ -66,7 +74,7 @@ function PipeIPC() {
while (!isRead) {
try {
text = this.reader.ReadAll();
text = this._read();
isRead = true;
} catch (e) {
this.closeReader();