The My C program executes commands in the bash shell. For this, I fork and in the child process I run:
char* command = "..."; execlp("/bin/bash", "bash", "-c", command, NULL);
If this is a long team, I would like to be able to kill her. For example, let's say what I do:
execlp("/bin/bash", "bash", "-c", "find / test", NULL);
After that, I know the PID of the child executing bash, but bash does the deployment of a separate process to do the search.
$ ps aux | grep find zmb 7802 0.0 0.1 5252 1104 pts/1 S+ 11:17 0:00 bash -c find / test zmb 7803 0.0 0.0 4656 728 pts/1 S+ 11:17 0:00 find / test
I can kill the bash process (7802), but the find (7803) process is still running. How can I ensure that the bash process propagates signals to children for it?
source share