]> SALOME platform Git repositories - modules/kernel.git/blobdiff - src/Launcher/Launcher_Job_Command.cxx
Salome HOME
Compilation under Windows: add missing header
[modules/kernel.git] / src / Launcher / Launcher_Job_Command.cxx
index e4f18f96e9d53ea846e44ba536e98f01a4b624f5..eb86061b8cc58b0a151e574753f0f36c12d9ed30 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2017  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2009-2021  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -29,6 +29,7 @@
 #ifdef WIN32
 #include <io.h>
 #define _chmod chmod
+#include <process.h>
 #endif
 
 #include <sstream>
@@ -62,7 +63,11 @@ Launcher::Job_Command::buildCommandScript(Batch::Parametre params, std::string l
   // File name
   std::string launch_date_port_file = launch_date;
   std::ostringstream str_pid;
+#ifdef WIN32
+  str_pid << _getpid();
+#else
   str_pid << ::getpid();
+#endif
   std::string launch_script = Kernel_Utils::GetTmpDir() + "runCommand_"
                               + _job_file_name + "_" + launch_date + "-"
                               + str_pid.str();
@@ -79,7 +84,7 @@ Launcher::Job_Command::buildCommandScript(Batch::Parametre params, std::string l
   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/end_code.log" << std::endl;
+  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 != "")
@@ -101,7 +106,7 @@ Launcher::Job_Command::buildCommandScript(Batch::Parametre params, std::string l
   launch_script_stream << runCommandString() << std::endl;
 #ifndef WIN32
   // log the exit code
-  launch_script_stream << "echo $? > logs/end_code.log" << std::endl;
+  launch_script_stream << "echo $? > logs/exit_code.log" << std::endl;
 #endif
 
   // Return