Skip to content

Commit

Permalink
terminate run as fast as possible if any output file exists
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelHu authored Dec 17, 2024
1 parent a09ff03 commit 076316f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/RMGRunAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,10 @@ std::pair<fs::path, fs::path> RMGRunAction::BuildOutputFile() const {
auto path_for_overwrite =
fs::path(G4Analysis::GetTnFileName(path.string(), path.extension().string()));
if (fs::exists(path_for_overwrite) && !manager->GetOutputOverwriteFiles()) {
G4RunManager::GetRunManager()->AbortRun(true);
RMGLog::Out(RMGLog::error, "Output file ", path_for_overwrite.string(), " does already exists.");
// need to abort here (and not use ::fatal), as Geant4 is not prepared to take exceptions at this stage.
// also, there is no clean way to abort an run before the run started.
std::abort();
}

auto ext = path.extension();
Expand Down

0 comments on commit 076316f

Please sign in to comment.