Hi 👋,
Hope everyone is doing great.
Is your feature request related to a problem? Please describe.
I used require("child_process").spawn recently with the option shell: true.
I observe in this case that two processes are spawned on for the shell itself and another one for the current command spawned by the shell.
So when I use ChildProcess.kill(), it kills the shell process but not its child (descendent processes). (In my case the child process is an HTTP server, so a long process that doesn't exist itself")
Describe the solution you'd like
I thought about two different APIs:
- First one (with the ChildProcess)
const { spawn } = require("child_process");
const p1 = spawn(httpServerCommand, { shell: true });
p1.killDeep();
- Second one (with
process)
const { spawn } = require("child_process");
const p1 = spawn(httpServerCommand, { shell: true });
process.killDeep(p1.pid);
In both cases killDeep will kill all the descendent processes.
Describe alternatives you've considered
I used this library: https://www.npmjs.com/package/tree-kill
I'm sorry in advance if I miss something in the documentation (But I promise that I tried ahahah)
If this feature request is acceptable, I could help and contribute (with a bit of guidance ^^)
Thanks for reading me.
Hi 👋,
Hope everyone is doing great.
Is your feature request related to a problem? Please describe.
I used
require("child_process").spawnrecently with the optionshell: true.I observe in this case that two processes are spawned on for the shell itself and another one for the current command spawned by the shell.
So when I use ChildProcess.kill(), it kills the shell process but not its child (descendent processes). (In my case the child process is an HTTP server, so a long process that doesn't exist itself")
Describe the solution you'd like
I thought about two different APIs:
process)In both cases
killDeepwill kill all the descendent processes.Describe alternatives you've considered
I used this library: https://www.npmjs.com/package/tree-kill
I'm sorry in advance if I miss something in the documentation (But I promise that I tried ahahah)
If this feature request is acceptable, I could help and contribute (with a bit of guidance ^^)
Thanks for reading me.