i'm starting a background process (on windows) from electron main, something like this:
app_exe = require("child_process").spawn(
"app.exe" ,
[ "--params", ... ],
{ stdio: "ignore" }
);
this works fine, i can see this from process explorer:
but i cannot kill the process when the electron is closed ( .on("closed")
or on("window-all-closed")
)
i tried child.kill([signal])
, but also tree-kill or taskkill with no results: only the first process (6036 from the example) is killed, the second (5760) remains stale.
also exec taskkill /F /T /PID
doesn't kill it.
the only way to kill is exec taskkill /F /IM app.exe /T
, but in this way i cannot run two instances of the electron app.
i'm missing something obvious on process management on windows?