Update pipe-ipc.js

This commit is contained in:
Namhyeon Go 2023-09-21 21:44:26 +09:00 committed by GitHub
parent 01b5e7d46f
commit f904b43777
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -144,7 +144,6 @@ function PipeIPC() {
return new Date().getTime(); return new Date().getTime();
}; };
this.setCharset = function(charset) { this.setCharset = function(charset) {
this.charset = charset; this.charset = charset;
}; };
@ -381,6 +380,7 @@ function PipeIPC() {
return s.length > 1 ? s.substring(1) : ''; return s.length > 1 ? s.substring(1) : '';
})(fh.ReadAll()); })(fh.ReadAll());
} catch (e) { } catch (e) {
//console.log(e.message);
return ''; return '';
} }
}; };
@ -423,7 +423,7 @@ function PipeIPC() {
while (!isRead) { while (!isRead) {
try { try {
var ado = createADO(); var ado = createADO();
ado.CharSet = charset; ado.Charset = charset;
ado.Open(); ado.Open();
ado.LoadFromFile(filename); ado.LoadFromFile(filename);
text += ado.ReadText(); text += ado.ReadText();
@ -441,8 +441,9 @@ function PipeIPC() {
return text; return text;
}; };
this.loadFromFile = function(filename) { this.loadFromFile = function(filename, charset) {
this.write(this.readTextFromFile(filename, this.charset), ForWriting); charset = (typeof charset !== "undefined" ? this.charset : charset);
this.write(this.readTextFromFile(filename, charset), ForWriting);
}; };
this.reload = function(charset) { this.reload = function(charset) {
@ -476,7 +477,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.15"; exports.VERSIONINFO = "PIPE-based IPC Module (pipe-ipc.js) version 0.1.16";
exports.AUTHOR = "abuse@catswords.net"; exports.AUTHOR = "abuse@catswords.net";
exports.global = global; exports.global = global;
exports.require = require; exports.require = require;