node-tree-kill
node-tree-kill copied to clipboard
Tree kill not killing spawned docker processes
Is tree kill meant to kill all child processes? Even if they are docker processes? I am trying to kill a child process that runs docker commands but kill tree only kills the node process. I will attach some code snippets but kill(childID) is not killing the sub processes.
const kill = require('tree-kill'); / npm install tree-kill --save
I create a bash script and spawn a child process to run it. `let buildScript = "docker build -t " + image_name + " . \n";
buildScript += "docker run -v /var/run/docker.sock:/var/run/docker.sock " + image_name + " \n";
buildScript += "docker rmi " + image_name + " \n";
const dockerBuild = spawn('bash', ['-c', buildScript]);
console.log(dockerBuild.pid);
childPID = dockerBuild.pid;`
then to try to kill it I run `console.log('child piid ======', childPID);
kill(childPID, 'SIGKILL', function(err) {
console.log('error here ------', err);
});`
The childPID comes in correctly and the node process does get killed I believe but docker run and build continue to run even after I have called the tree kill with the childPID. Any help or suggestions would be great thank you!