Skip to content

Commit

Permalink
Comply with cert-msc54-cpp,cert-sig30-c with sw_message()
Browse files Browse the repository at this point in the history
- Move the message that occurs when a signal occurs to the end of run simulation function
- Update the message to be "Program was killed early. Shutting down..."
  • Loading branch information
N1ckP3rsl3y committed Dec 9, 2024
1 parent 4b43a46 commit 139ad76
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/SW_Control.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@ interrupts (SIGINT, commonly CTRL+C on the keyboard)
static void handle_interrupt(int signal) {
(void) signal; /* Silence compiler */
runSims = 0;

#if defined(SOILWAT)
// NOLINTNEXTLINE(bugprone-signal-handler,cert-msc54-cpp,cert-sig30-c)
sw_message("Program was killed early. Shutting down after the current "
"simulation run...");
#endif
}

/**
Expand Down Expand Up @@ -408,6 +402,12 @@ void SW_CTL_RunSimSet(
}

wrapUp:
#if defined(SOILWAT)
if (runSims == 0) {
sw_message("Program was killed early. Shutting down...");
}
#endif

SW_WallTime->timeSimSet = diff_walltime(tss, ok_tss);
}

Expand Down

0 comments on commit 139ad76

Please sign in to comment.