I have a program with two processes. One of them could terminate or exit because an exception. While i'm testing the program I finish it using Control+c but the child process is still running.
Is there any option to kill the process when I push control+c or when the father process terminates.
There's no option to automate this however you can code your applications to support it. A pre-requisite is that the process which wants the other to terminate must have its process id; this is the value the parent receives back from a fork() call.
Give each process a signal handler for SIGINT - when control-C is pressed, SIGINT is sent to the process. In this signal handler, send the signal to your other process and then exit().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With