Salome HOME
Merge tag 'V8_5_0' into omu/Launcher9
[modules/kernel.git] / src / Launcher / Launcher_Job_Command.cxx
index c725dc24fd3caae950a08d5034556442d057a103..b71d7373534db4fc3b575fbfd68c411c3c06476b 100644 (file)
@@ -78,6 +78,8 @@ Launcher::Job_Command::buildCommandScript(Batch::Parametre params, std::string l
 #ifndef WIN32
   launch_script_stream << "#!/bin/sh -f" << std::endl;
   launch_script_stream << "cd " << work_directory << std::endl;
+  // remove the exit code from any previous execution
+  launch_script_stream << "rm -f logs/exit_code.log" << std::endl;
   launch_script_stream << "export PYTHONPATH=" << work_directory << ":$PYTHONPATH" << std::endl;
   launch_script_stream << "export PATH=" << work_directory << ":$PATH" << std::endl;
   if (_env_file != "")
@@ -97,6 +99,10 @@ Launcher::Job_Command::buildCommandScript(Batch::Parametre params, std::string l
   }
 #endif
   launch_script_stream << runCommandString() << std::endl;
+#ifndef WIN32
+  // log the exit code
+  launch_script_stream << "echo $? > logs/exit_code.log" << std::endl;
+#endif
 
   // Return
   launch_script_stream.flush();