mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 23:41:42 +00:00
38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
var SHELL = require("lib/shell");
|
|
|
|
var SandboxieObject = function() {
|
|
this.binPath = "%PROGRAMFILES%\\Sandboxie-Plus\\Start.exe";
|
|
this.processID = 0;
|
|
this.sandboxName = "";
|
|
|
|
this.setSandboxName = function(name) {
|
|
this.sandboxName = name;
|
|
return this;
|
|
};
|
|
|
|
this.start = function(cmd) {
|
|
var process;
|
|
while (this.processID == 0) {
|
|
try {
|
|
process = SHELL.createProcess([
|
|
this.binPath,
|
|
"/box:" + this.sandboxName,
|
|
SHELL.build(cmd)
|
|
].join(' '));
|
|
this.processID = process.ProcessID;
|
|
} catch (e) {
|
|
console.error(e.message);
|
|
}
|
|
}
|
|
return this;
|
|
};
|
|
};
|
|
|
|
exports.start = function(sandboxName, cmd) {
|
|
return (new SandboxieObject()).setSandboxName(sandboxName).start(cmd).processID;
|
|
};
|
|
|
|
exports.VERSIONINFO = "Sandboxie interface (sandboxie.js) version 0.1";
|
|
exports.global = global;
|
|
exports.require = global.require;
|