Skip to content
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

Tree kill not killing spawned docker processes #37

Open
maja5627 opened this issue Jul 27, 2021 · 0 comments
Open

Tree kill not killing spawned docker processes #37

maja5627 opened this issue Jul 27, 2021 · 0 comments

Comments

@maja5627
Copy link

maja5627 commented Jul 27, 2021

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant