jeudi 25 juin 2015

kill subprocess if proc

I'm using C++11 and linux. I am attempting to start up multiple ssh commands using fork() and popen() and monitor when the ssh command stops running. When I kill the ssh command on the other computer, it doesn't appear to kill the fork() child process that started it. The child process continues the run until I exit the program. What do I need to do to kill the child process once the ssh command which was called with popen() quits running? Is there something better I could use for this than popen() to call the ssh command?

Aucun commentaire:

Enregistrer un commentaire