I'm trying to run scripts/node.js processes from another node.js processes. I figured out how to start them with child_process.spawn() and I have the PID from it but i can't figure out how to kill them. Using child_process.exec() to run taskkill with doesn't work even with/F, even though it says the "task-killing" was successful, the node.js window is stil running. I've even tried powershell's stop-process but that doesn't work either. How do I kill it? (from node.js)
Edit:
Both process.kill(pid,15) and process.kill(pid,9) end with:
Error: kill ESRCH errno: -4040,code: 'ESRCH',syscall: 'kill'