diff --git a/DDCore/src/DetectorLoad.cpp b/DDCore/src/DetectorLoad.cpp index cf464a4dd..442ee5132 100644 --- a/DDCore/src/DetectorLoad.cpp +++ b/DDCore/src/DetectorLoad.cpp @@ -21,6 +21,9 @@ // C/C++ include files #include +#include +#include +#include #ifndef __TIXML__ #include @@ -47,6 +50,19 @@ DetectorLoad::~DetectorLoad() { /// Process XML unit and adopt all data from source structure. void DetectorLoad::processXML(const std::string& xmlfile, xml::UriReader* entity_resolver) { + + // Install signal handler for SIGINT (Ctrl-C) + struct sigaction sigIntHandler; + + sigIntHandler.sa_handler = [](int) { + std::cerr << "Caught signal SIGINT, exiting..." << std::endl; + exit(1); + }; + sigemptyset(&sigIntHandler.sa_mask); + sigIntHandler.sa_flags = 0; + + sigaction(SIGINT, &sigIntHandler, NULL); + try { xml::DocumentHolder doc(xml::DocumentHandler().load(xmlfile,entity_resolver)); if ( doc ) {