Update pipe-ipc.js

This commit is contained in:
Namhyeon Go 2023-09-21 18:57:42 +09:00 committed by GitHub
parent c4ccdaf1aa
commit 6b55a2d0de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,7 +98,7 @@ function openTextFile(filename, iomode) {
} }
function checkFileExists(filename) { function checkFileExists(filename) {
return createFSO().FileExists(filename); return createFSO().FileExists(filename);;
} }
function deleteFile(filename) { function deleteFile(filename) {
@ -156,6 +156,7 @@ function PipeIPC() {
this.path = this.path.replace(":pipename", pipename); this.path = this.path.replace(":pipename", pipename);
//this.openWriter(); //this.openWriter();
this.openReader(); this.openReader();
//console.info("Opened pipe:", pipename);
if (typeof callback === "function") { if (typeof callback === "function") {
callback(this, this.reader, this.writer); callback(this, this.reader, this.writer);
} }
@ -365,7 +366,9 @@ function PipeIPC() {
}; };
this._read = function() { this._read = function() {
return this.reader.ReadAll(); return (function(s) {
return s.length > 1 ? s.substring(1) : '';
})(this.reader.ReadAll());
}; };
this.read = function() { this.read = function() {
@ -413,6 +416,7 @@ function PipeIPC() {
ado.Close(); ado.Close();
isRead = true; isRead = true;
} catch (e) { } catch (e) {
//console.log(e.message);
isRead = false; isRead = false;
} }
} }
@ -423,8 +427,8 @@ function PipeIPC() {
return text; return text;
}; };
this.loadFromFile = function(filename, charset) { this.loadFromFile = function(filename) {
this.write(this.readTextFromFile(filename, charset), ForWriting); this.write(this.readTextFromFile(filename, this.charset), ForWriting);
}; };
this.reload = function(charset) { this.reload = function(charset) {
@ -458,7 +462,7 @@ exports.adSaveCreateNotExist = adSaveCreateNotExist;
exports.adSaveCreateOverWrite = adSaveCreateOverWrite; exports.adSaveCreateOverWrite = adSaveCreateOverWrite;
exports.adModeReadWrite = adModeReadWrite; exports.adModeReadWrite = adModeReadWrite;
exports.VERSIONINFO = "PIPE-based IPC Module (pipe-ipc.js) version 0.1.13"; exports.VERSIONINFO = "PIPE-based IPC Module (pipe-ipc.js) version 0.1.14";
exports.AUTHOR = "abuse@catswords.net"; exports.AUTHOR = "abuse@catswords.net";
exports.global = global; exports.global = global;
exports.require = require; exports.require = require;