diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp index 937facdfdf129cc2708a44b44e7b152a4ff068d3..39eb8802adefff06cf87af69d9df4b853aa7afcc 100644 --- a/Common/GmshMessage.cpp +++ b/Common/GmshMessage.cpp @@ -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"); diff --git a/Common/OS.cpp b/Common/OS.cpp index 246f8d23b85c54d6be632f8ed7cbdd671b50eb0d..380fb481f09ea706672487df87a1cbd58ee688aa 100644 --- a/Common/OS.cpp +++ b/Common/OS.cpp @@ -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{ diff --git a/Common/OS.h b/Common/OS.h index 808f56fba27482f2e5531c78aea4ef75153d45e4..115415e853416c90b028c64eb04f029772096573 100644 --- a/Common/OS.h +++ b/Common/OS.h @@ -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);