Sending SIGINT to forked exec process which runs script does not kill it
问题 I'm writing shell application with C and encountered a problem that sending SIGINT to process running script won't stop it. Sending the same signal to a normal executable works just fine. Example: Bash script which just imitates long working script (work.sh): #! /bin/bash COUNTER=0 while true do ((COUNTER+=1)) echo "#${COUNTER} Working..." sleep 1 done C code: int main() { pid_t pid = fork(); if (pid == 0) { char* cmds[] = { "./work.sh", NULL }; if (execvp(cmds[0], cmds) == -1) { exit(1); } }