Skip to content

Commit ea841a5

Browse files
committed
exit requests are not fatal
1 parent 6f05b88 commit ea841a5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/mainReadout.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ class Readout
317317
}
318318

319319
// Wrapper function to catch exception and report fatal errors
320-
int executeFunction(std::string actionName, std::function<int()> f) {
320+
int executeFunction(std::string actionName, std::function<int()> f, int plusZeroIsFatal = 1, int minusZeroIsFatal = 1) {
321321
// theLog.log(LogDebugDevel, "Calling function for %s",actionName.c_str());
322322
int err = -1;
323323
try {
@@ -326,7 +326,7 @@ class Readout
326326
catch (const std::exception& e) {
327327
theLog.log(LogErrorSupport_(3245), "Exception : %s", e.what());
328328
}
329-
if (err) {
329+
if ( ((err<0)&&(minusZeroIsFatal)) || ((err>0)&&(plusZeroIsFatal)) ) {
330330
std::vector<std::string> m;
331331
theLog.historyGetSummary(m);
332332
std::string reason = "Readout failed in " + actionName + ". Please check previous messages.";
@@ -355,7 +355,7 @@ class Readout
355355
return executeFunction("STOP", std::bind(&Readout::_stop, this));
356356
}
357357
int iterateRunning() {
358-
return executeFunction("RUNNING", std::bind(&Readout::_iterateRunning, this));
358+
return executeFunction("RUNNING", std::bind(&Readout::_iterateRunning, this), 0, 1); // special handling of positive error code: not fatal
359359
}
360360
int iterateCheck() {
361361
return executeFunction("CHECK", std::bind(&Readout::_iterateCheck, this));

0 commit comments

Comments
 (0)