Skip to content
Snippets Groups Projects
Commit b3ce786a authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

clarify exe vs. args + make OnelabRunClient treat exe as full command line

parent 13b98a88
No related branches found
No related tags found
No related merge requests found
......@@ -1183,7 +1183,7 @@ void Msg::ImportPhysicalsAsOnelabRegions()
#endif
}
void Msg::RunOnelabClient(const std::string &name, const std::string &exe)
void Msg::RunOnelabClient(const std::string &name, const std::string &command)
{
#if defined(HAVE_ONELAB) && !defined(HAVE_ONELAB2)
onelab::server::citer it = onelab::server::instance()->findClient(name);
......@@ -1192,7 +1192,7 @@ void Msg::RunOnelabClient(const std::string &name, const std::string &exe)
client = it->second;
}
else{
if(exe.empty()){
if(command.empty()){
Msg::Error("Unknown ONELAB client `%s'", name.c_str());
return;
}
......@@ -1202,8 +1202,8 @@ void Msg::RunOnelabClient(const std::string &name, const std::string &exe)
onelab::server::instance()->set(o);
#if defined(HAVE_FLTK)
Msg::Info("Creating new ONELAB client `%s' (%s)", name.c_str(),
exe.c_str());
client = new gmshLocalNetworkClient(name, exe);
command.c_str());
client = new gmshLocalNetworkClient(name, command, "", true);
client->run();
#else
Msg::Error("Cannot create ONELAB client without FLTK");
......
......@@ -380,7 +380,8 @@ int KillProcess(int pid)
return 1;
}
int SystemCallExe(const std::string &exe, const std::string &args, bool blocking)
int SystemCallExe(const std::string &exe, const std::string &argsOrCommand,
bool blocking)
{
// do we try to run a .py script, .m script or an .exe?
std::vector<std::string> split = SplitFileName(exe);
......@@ -398,17 +399,17 @@ int SystemCallExe(const std::string &exe, const std::string &args, bool blocking
std::string command;
if(exe.size()){
command.append("\"" + exe + "\""); // allows exe with white space
if(args.size()) command.append(" ");
if(argsOrCommand.size()) command.append(" ");
}
command.append(args);
command.append(argsOrCommand);
#if defined(WIN32) && !defined(__CYGWIN__)
if(isPython || isOctave){
Msg::Info("Shell opening '%s' with arguments '%s'", exe.c_str(),
args.c_str());
argsOrCommand.c_str());
setwbuf(0, "open");
setwbuf(1, exe.c_str());
setwbuf(2, args.c_str());
setwbuf(2, argsOrCommand.c_str());
ShellExecuteW(NULL, wbuf[0], wbuf[1], wbuf[2], NULL, 0);
}
else{
......
......@@ -25,7 +25,8 @@ int KillProcess(int pid);
int CreateSingleDir(const std::string &dirName);
void CreatePath(const std::string &fullPath);
int SystemCall(const std::string &command, bool blocking=false);
int SystemCallExe(const std::string &exe, const std::string &args, bool blocking=false);
int SystemCallExe(const std::string &exe, const std::string &argsOrCommand,
bool blocking=false);
std::string GetCurrentWorkdir();
void RedirectIOToConsole();
FILE *Fopen(const char* f, const char *mode);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment