Allow runAsMainSingleModule to be called more than once
[alexxy/gromacs.git] / src / gromacs / commandline / cmdlineinit.cpp
index 8fe171ee058c34e3ba807a752211baea35b95afd..003ad846c901535989875ef5900e9af1d69eeafd 100644 (file)
@@ -140,6 +140,13 @@ void finalizeForCommandLine()
     g_commandLineContext.reset();
 }
 
+int processExceptionAtExitForCommandLine(const std::exception &ex)
+{
+    int rc = processExceptionAtExit(ex); //Currently this aborts for GMX_LIB_MPI
+    finalizeForCommandLine();            //thus this MPI_Finalize doesn't matter
+    return rc;
+}
+
 int runCommandLineModule(int argc, char *argv[],
                          CommandLineModuleInterface *module)
 {