QProcess kill multiple scripts
-
I use QProcess to start a shell script a, and script a starts script b. When QProcess sends a kill signal, it can only stop script a. Is there any good way to stop script b at the same time?
@adwsf
The QtQProcessonly know about script A, it has no idea that script has started a script B. So the only proper way is for script A to either kill script B when script A is about to be killed or (better) to ensure that when script A is killed the OS will in turn kill script B since A is its parent.Since you say nothing about your platform or how scripts run each other nobody knows what the situation is. You won't be able to have script A act on receiving a
SIGKILL, so if you want to take the first route you would be better usingQProcess:terminate()thanQProcess::kill(). Otherwise you are looking for solutions like killing process groups.