@@ -210,6 +210,20 @@ static double GetDebugWorkerDelay()
210
210
}
211
211
#endif /* I2_DEBUG */
212
212
213
+ void throw_test_exception () {
214
+ if (!Utility::GetFromEnvironment (" DEBUG_ABORT" ).IsEmpty ()) {
215
+ abort ();
216
+ }
217
+ if (!Utility::GetFromEnvironment (" DEBUG_THROW_CXX" ).IsEmpty ()) {
218
+ throw std::runtime_error (" test exception" );
219
+ }
220
+ #ifdef _WIN32
221
+ if (!Utility::GetFromEnvironment (" DEBUG_THROW_SEH" ).IsEmpty ()) {
222
+ RaiseException (42 , 0 , 0 , nullptr );
223
+ }
224
+ #endif
225
+ }
226
+
213
227
/* *
214
228
* Do the actual work (config loading, ...)
215
229
*
@@ -285,6 +299,8 @@ int RunWorker(const std::vector<std::string>& configs, bool closeConsoleLog = fa
285
299
}
286
300
}
287
301
302
+ throw_test_exception ();
303
+
288
304
/* Create the internal API object storage. Do this here too with setups without API. */
289
305
ConfigObjectUtility::CreateStorage ();
290
306
@@ -520,8 +536,10 @@ static pid_t StartUnixWorker(const std::vector<std::string>& configs, bool close
520
536
_exit (RunWorker (configs, closeConsoleLog, stderrFile));
521
537
} catch (const std::exception & ex) {
522
538
Log (LogCritical, " cli" ) << " Exception in main process: " << DiagnosticInformation (ex);
539
+ throw ;
523
540
_exit (EXIT_FAILURE);
524
541
} catch (...) {
542
+ throw ;
525
543
_exit (EXIT_FAILURE);
526
544
}
527
545
@@ -687,8 +705,10 @@ int DaemonCommand::Run(const po::variables_map& vm, const std::vector<std::strin
687
705
return RunWorker (configs);
688
706
} catch (const std::exception & ex) {
689
707
Log (LogCritical, " cli" ) << " Exception in main process: " << DiagnosticInformation (ex);
708
+ throw ;
690
709
return EXIT_FAILURE;
691
710
} catch (...) {
711
+ throw ;
692
712
return EXIT_FAILURE;
693
713
}
694
714
#else /* _WIN32 */
0 commit comments