Update the subprocess handler to take a CWD
This commit is contained in:
@@ -12,9 +12,15 @@ const runningProcesses = {};
|
||||
* @param {string[]} args - The arguments to pass to the process.
|
||||
* @param {boolean} waitForClose - Set this to wait to return until the process exits
|
||||
*/
|
||||
export const launchProcess = (processName, args, waitForClose=false) => {
|
||||
export const launchProcess = (processName, args, waitForClose=false, pcwd=undefined) => {
|
||||
if (!runningProcesses[processName]) {
|
||||
const childProcess = spawn(processName, args);
|
||||
let childProcess;
|
||||
if (pcwd) {
|
||||
childProcess = spawn(processName, args, {cwd: pcwd});
|
||||
}
|
||||
else {
|
||||
childProcess = spawn(processName, args);
|
||||
}
|
||||
|
||||
// Store reference to the spawned process
|
||||
runningProcesses[processName] = childProcess;
|
||||
|
||||
Reference in New Issue
Block a user