mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-11 20:21:03 +00:00
Update pipe-ipc.js
This commit is contained in:
parent
590dde45c1
commit
c189a940e5
|
@ -25,9 +25,9 @@ function PipeIPC() {
|
|||
}
|
||||
};
|
||||
|
||||
this.createWriter = function() {
|
||||
this.createWriter = function(iomode) {
|
||||
//this.writer = CreateObject("Scripting.FileSystemObject").CreateTextFile(this.path, true, true);
|
||||
this.writer = CreateObject("Scripting.FileSystemObject").OpenTextFile(this.path, ForAppending, true, TristateTrue);
|
||||
this.writer = CreateObject("Scripting.FileSystemObject").OpenTextFile(this.path, iomode, true, TristateTrue);
|
||||
};
|
||||
|
||||
this.closeWriter = function() {
|
||||
|
@ -54,7 +54,8 @@ function PipeIPC() {
|
|||
|
||||
while (!isWritten) {
|
||||
try {
|
||||
this.createWriter();
|
||||
this.flush();
|
||||
this.createWriter(ForAppending);
|
||||
this._write(message);
|
||||
this.writer.Close();
|
||||
isWritten = true;
|
||||
|
@ -85,6 +86,21 @@ function PipeIPC() {
|
|||
return messages;
|
||||
};
|
||||
|
||||
this.flush = function() {
|
||||
var isFlushed = false;
|
||||
|
||||
while (!isFlushed) {
|
||||
try {
|
||||
this.createWriter(ForWriting);
|
||||
this._write("");
|
||||
this.writer.Close();
|
||||
isFlushed = true;
|
||||
} catch (e) {
|
||||
isFlushed = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.readText = function() {
|
||||
return this.read().join(' ');
|
||||
};
|
||||
|
@ -99,7 +115,7 @@ exports.create = function() {
|
|||
return new PipeIPC();
|
||||
};
|
||||
|
||||
exports.VERSIONINFO = "PIPE-based IPC Module (pipe-ipc.js) version 0.1.1";
|
||||
exports.VERSIONINFO = "PIPE-based IPC Module (pipe-ipc.js) version 0.1.2";
|
||||
exports.AUTHOR = "Nathan Catswords <catswords@protonmail.com>";
|
||||
exports.global = global;
|
||||
exports.require = require;
|
||||
|
|
Loading…
Reference in New Issue
Block a user