Skip to content Skip to sidebar Skip to footer

How To Prevent Sigint In Child Process From Propagating To And Killing Parent Process?

I've recently learned how to do the whole fork/exec/wait thing and ended up writing some code that looked like this stripped down: #include #include

Solution 1:

you can either catch the SIGINT or write a signal handler. use the code below:

signal(SIGINT, sig_handler);
void sig_handler(int signo)
{
  if (signo == SIGINT)
    printf("received SIGINT\n");
}

Post a Comment for "How To Prevent Sigint In Child Process From Propagating To And Killing Parent Process?"