-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
killing multiple child processes #4050
Comments
@CoyiCodes Are you running the code with elevated privileges? - Clerkie |
I am packing it with electron-builder then I tried both starting it by duble clicking and runing it as admin. Nothing changed unfortunately. |
I also encountered the same problem!I'm so sad |
cc @nodejs/child_process PTAL |
taskkill /F /PID xxxx /T can solve the problem |
This is the behavior of PyInstaller, see https://pyinstaller.readthedocs.io/en/stable/advanced-topics.html#the-bootstrap-process-in-detail. |
You are correct. Do you have any good solutions? At present, I can only kill all associated processes through tree-kill, but I don't think this is the best solution. |
I'm unable to solve the issue even by killing all the associated processes. I tried the following thing:
|
Currently, I'm using the following approach:
|
Hi! Node.js (AFAIK) doesn't support killing processes by name. If you manage to obtain the PID of the processes to kill, you can do it like that. Additionally, via the command you provided, Do you need more help, or can this be closed? |
That's what I found best, also suggested by others, fairly simple in use and less error prone function killPythonServer() {
const killCmd = `tskill processName`;
spawn('cmd.exe', ['/c', killCmd]);
}
app.on('quit', (event) => {
killPythonServer();
}); |
But this method only works on Windows... |
@lizhongyue248 yeah, I meant we can use the general idea of killing using the process name. Similar action in unix can be achieve via
|
Details
Hi I am trying to kill a process but I can not do it. I created a flask server with python and packed it with pyinstaller. When I start my electron app I start the process like this ( and it starts ok):
This is used under app.on('ready'...)
This creates 2 processes:
I am trying to kill the process on app.on('window-all-closed'...)
But this only kills PID 8868 and other one keeps running.
But When I run code the code below on command prompt. It kills all of them
They all kill only one of the processes. How Do I kill all processes with the same name?
Node.js version
v16.13.1
Example code
No response
Operating system
Windows 10
Scope
code
Module and version
Not applicable.
The text was updated successfully, but these errors were encountered: