-// 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
#ifdef WIN32
#include <io.h>
#define _chmod chmod
+#include <process.h>
#endif
#include <sstream>
// 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();
#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 != "")
}
#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();