Update shell.js

This commit is contained in:
Namhyeon Go 2022-06-28 13:01:19 +09:00 committed by GitHub
parent 7b0f0e3455
commit 6f5bfdfe74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,9 @@
// Shell API
////////////////////////////////////////////////////////////////////////
var FILE = require("lib/file");
var RAND = require("lib/rand");
var SEED = RAND.getSeed();
var ShellObject = function() {
this.interface = null;
@ -68,9 +71,8 @@ var ShellObject = function() {
this.exec = function(cmd, stdOutPath, stdErrPath) {
var stdout, stderr;
var seed = parseInt(Math.random() * 10000);
var stdOutPath = (typeof(stdOutPath) === "undefined" ? "tmp\\stdout_" + seed + ".txt" : stdOutPath);
var stdErrPath = (typeof(stdErrPath) === "undefined" ? "tmp\\stderr_" + seed + ".txt" : stdErrPath);
var stdOutPath = (typeof(stdOutPath) === "undefined" ? "tmp\\stdout_" + SEED + ".txt" : stdOutPath);
var stdErrPath = (typeof(stdErrPath) === "undefined" ? "tmp\\stderr_" + SEED + ".txt" : stdErrPath);
var c = "%comspec% /c (" + this.build(cmd) + ") 1> " + stdOutPath;
//c += " 2>&1";
@ -192,6 +194,6 @@ exports.getPathOfMyDocuments = function() {
return (new ShellObject()).getPathOfMyDocuments();
};
exports.VERSIONINFO = "Shell interface (shell.js) version 0.2";
exports.VERSIONINFO = "Shell interface (shell.js) version 0.3";
exports.global = global;
exports.require = global.require;