From 076316f11ea3beb737adbfdaa432c13f45ac95ed Mon Sep 17 00:00:00 2001 From: Manuel Huber Date: Tue, 17 Dec 2024 11:13:45 +0100 Subject: [PATCH] terminate run as fast as possible if any output file exists --- src/RMGRunAction.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/RMGRunAction.cc b/src/RMGRunAction.cc index 169fce69..1f14e571 100644 --- a/src/RMGRunAction.cc +++ b/src/RMGRunAction.cc @@ -242,8 +242,10 @@ std::pair 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();