In addition to its other error checks, Insure++ also traps certain signals when run on Unix systems. It does this by installing handlers when your program starts up. These do not interfere with your program’s own use of signals. Any code that manipulates signals will simply override the functions installed by Insure++.
Signal Handling Actions
When an unhandled signal is detected, Insure++ does the following
- Logs the signal in the Insure++ report file, if one is being used.
- Calls the function
- Takes the appropriate action for the signal.
If this last step will result in the program terminating, Insure++ attempts to close any open files properly. In particular, the Insure++ report file will be closed. This can only work if the program hasn’t crashed the I/O system. If, for example, the program has generated a “bus” or similar error, it might not be possible to close the open files. In the worst of all possible scenarios you will simply generate another (fatal) signal when Insure++ attempts to clean up.
Which Signals Are Trapped?
By default, Insure++ traps all signals. You can subtract from this list by adding lines to your .psrc file and re-running the program.
Signals are removed with the following command
insure++.signal_ignore SIGINT SIGQUIT SIGTERM
The SIG prefix is optional.