EZPPLauncher/electron/executeUtil.js

21 lines
485 B
JavaScript
Raw Permalink Normal View History

const childProcess = require("child_process");
const runFile = (folder, file, args, onExit) => {
2024-04-15 11:07:40 +00:00
childProcess.execFile(file, args, {
cwd: folder,
}, (_err, _stdout, _stdin) => {
if (onExit) onExit();
});
};
const runFileDetached = (folder, file, args) => {
2024-04-15 11:07:40 +00:00
const subProcess = childProcess.spawn(file + (args ? " " + args : ""), {
cwd: folder,
detached: true,
stdio: "ignore",
});
subProcess.unref();
};
2024-04-15 11:07:40 +00:00
module.exports = { runFile, runFileDetached };