changes error reporting and exit value to properly communicate issues

This commit is contained in:
2026-03-20 12:28:42 +01:00
parent a3c66ee744
commit e67d7b4301

View File

@@ -148,16 +148,17 @@ int sc_main(int argc, char* argv[]) {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
if(auto res = setjmp(abrt)) { if(auto res = setjmp(abrt)) {
switch(res) { switch(res) {
case SIGHUP: case SIGHUP:
case SIGINT: case SIGINT:
case SIGQUIT: case SIGQUIT:
case SIGTERM: case SIGTERM:
case SIGUSR1: case SIGUSR1:
case SIGUSR2: case SIGUSR2:
SCCINFO() << "Simulation stopped with signal " << res << "."; sc_core::sc_stop();
break; SCCINFO() << "Simulation stopped with signal " << sigabbrev_np(res) << ".";
default: break;
SCCERR() << "Simulation aborted with signal " << res << "!"; default:
SCCERR() << "Simulation aborted with signal " << sigabbrev_np(res) << "!";
} }
} else { } else {
try { try {
@@ -171,5 +172,5 @@ int sc_main(int argc, char* argv[]) {
sc_core::sc_report_handler::get_handler()(rep, sc_core::SC_DISPLAY | sc_core::SC_STOP); sc_core::sc_report_handler::get_handler()(rep, sc_core::SC_DISPLAY | sc_core::SC_STOP);
} }
} }
return 0; return sc_core::sc_report_handler::get_count(SC_ERROR) + sc_core::sc_report_handler::get_count(SC_WARNING);
} }