Update shell.js

This commit is contained in:
Namhyeon Go 2021-06-25 04:29:51 +09:00 committed by GitHub
parent 1a3c8e1b06
commit e277141bf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,28 +75,28 @@ var ShellObject = function() {
this.exec = function(cmd, stdOutPath, stdErrPath) {
var stdout, stderr;
var stdOutPath = (typeof(stdOutPath) === "undefined" ? "stdout.txt" : stdOutPath);
var stdErrPath = (typeof(stdErrPath) === "undefined" ? "stderr.txt" : stdErrPath);
var stdOutPath = (typeof(stdOutPath) === "undefined" ? "stdout.txt" : stdOutPath);
var stdErrPath = (typeof(stdErrPath) === "undefined" ? "stderr.txt" : stdErrPath);
var c = "%comspec% /c (" + this.build(cmd) + ") 1> " + stdOutPath;
//c += " 2>&1";
c += " 2> " + stdErrPath;
c += " 2> " + stdErrPath;
this.interface.Run(c, 0, true);
console.info("ShellObject.exec() -> " + c);
sleep(1);
sleep(1);
if (FILE.fileExists(stdOutPath)) {
stdout = FILE.readFile(stdOutPath, "utf-8");
FILE.deleteFile(stdOutPath);
}
if (FILE.fileExists(stdOutPath)) {
stdout = FILE.readFile(stdOutPath, "utf-8");
FILE.deleteFile(stdOutPath);
}
if (FILE.fileExists(stdErrPath)) {
stderr = FILE.readFile(stdErrPath, "utf-8");
FILE.deleteFile(stdErrPath);
}
if (FILE.fileExists(stdErrPath)) {
stderr = FILE.readFile(stdErrPath, "utf-8");
FILE.deleteFile(stdErrPath);
}
//console.log("[stdout] " + stdout);
//console.log("[stderr] " + stderr);
//console.log("[stdout] " + stdout);
//console.log("[stderr] " + stderr);
return stdout;
};