Implementing-Python-Client_#19 #32
@@ -12,9 +12,15 @@ const runningProcesses = {};
|
|||||||
* @param {string[]} args - The arguments to pass to the process.
|
* @param {string[]} args - The arguments to pass to the process.
|
||||||
* @param {boolean} waitForClose - Set this to wait to return until the process exits
|
* @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]) {
|
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
|
// Store reference to the spawned process
|
||||||
runningProcesses[processName] = childProcess;
|
runningProcesses[processName] = childProcess;
|
||||||
|
|||||||
Reference in New Issue
Block a user