diff --git a/Modules/IO/TestKernel/src/otbTestDriver.cxx b/Modules/IO/TestKernel/src/otbTestDriver.cxx index 3cc8444bbef895fb40132d9a125899a8e2cc1fa3..930c1910b4ea1311fbb60faa47bbf0e29845e533 100644 --- a/Modules/IO/TestKernel/src/otbTestDriver.cxx +++ b/Modules/IO/TestKernel/src/otbTestDriver.cxx @@ -200,6 +200,7 @@ int Execute(int argc, char * argv[]) itksysProcess_Execute(process); itksysProcess_WaitForExit(process, nullptr); int retCode = itksysProcess_GetExitValue(process); + itksysProcess_Delete(process); return retCode; } diff --git a/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx b/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx index 8cdca28487f797c1b6962edf031eeb623fea8c77..816e56d81fc7ea3f9c9f178198cc999eea1e6cb7 100644 --- a/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx +++ b/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx @@ -264,12 +264,6 @@ void ShowUsage(char* argv[]) int main(int argc, char* argv[]) { - #ifdef OTB_USE_MPI - otb::MPIConfig::Instance()->Init(argc,argv); - #endif - - otb::ConfigurationManager::InitOpenMPThreads(); - if (argc < 2) { ShowUsage(argv); @@ -299,15 +293,22 @@ int main(int argc, char* argv[]) } } - typedef otb::Wrapper::CommandLineLauncher LauncherType; - LauncherType::Pointer launcher = LauncherType::New(); - if (vexp.empty()) { ShowUsage(argv); return EXIT_FAILURE; } + #ifdef OTB_USE_MPI + if (std::find(vexp.begin(), vexp.end(), "-testenv") == vexp.end() ) + otb::MPIConfig::Instance()->Init(argc,argv); + #endif + + otb::ConfigurationManager::InitOpenMPThreads(); + + typedef otb::Wrapper::CommandLineLauncher LauncherType; + LauncherType::Pointer launcher = LauncherType::New(); + bool success = launcher->Load(vexp) && launcher->ExecuteAndWriteOutput(); // shutdown MPI after application finished