mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
If we receive a signal, we re-register ALL previous signal handlers.
This fixes the case when we pass signal to previously registered handler, and it needs to transform the signal into different one. Still problematic: What if the signal handler we replaced does not terminate the application? We can end up in a weird state and loop forever. Possible solution: Deregister our signal handlers, CALL the previous signal handler explicitly and if control returns, abort. This would however complicate our code quite a bit, as we would have to parse the sigaction we delegate to, decide whether to use signal handler or signal action, etc...
This commit is contained in:
parent
7c8b93eac3
commit
ffc4a9dc14
@ -118,10 +118,10 @@ namespace Catch {
|
||||
SignalDefs &def = signalDefs[i];
|
||||
if (sig == def.id) {
|
||||
name = def.name;
|
||||
sigaction(def.id, &oldSigActions[i], CATCH_NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
reset();
|
||||
reportFatal(name, -sig);
|
||||
raise( sig );
|
||||
}
|
||||
@ -146,7 +146,7 @@ namespace Catch {
|
||||
~FatalConditionHandler() {
|
||||
reset();
|
||||
}
|
||||
void reset() {
|
||||
static void reset() {
|
||||
if( isSet ) {
|
||||
// Set signals back to previous values -- hopefully nobody overwrote them in the meantime
|
||||
for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) {
|
||||
|
Loading…
Reference in New Issue
Block a user