When working on a Windows system with TypeScript
I face an issue with a function that launches another application via the command line. I am able to capture the Pid spawned by this Exec Function, but it turns out to be the Pid of the CMD used to initiate the application, not the application itself.
pid = exec('cd location && python appName.py', (err, data, getter) =>{
if (err){
console.log(err)
}
}).pid;
This only provides the pid of the CMD process, not the actual application.
I need to store the correct pid so I can use it later to terminate the process using ps.kill.
ps.kill(pid, (err) =>{});
Any suggestions for resolving this issue?