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

new treatExecutableAsFullCommandLine flag, set for running subclients

parent 41d42adc
No related branches found
No related tags found
No related merge requests found
......@@ -395,7 +395,7 @@ class GmshServer : public GmshSocket{
}
}
if(exe && strlen(exe) && args && strlen(args)){
if((exe && strlen(exe)) || (args && strlen(args))){
char s[1024];
sprintf(s, args, _sockname.c_str());
NonBlockingSystemCall(exe, s); // starts the solver
......
......@@ -114,9 +114,15 @@ class onelabGmshServer : public GmshServer{
std::string exe = FixWindowsPath(_client->getExecutable());
std::string args;
if(exe.size()){
if(_client->treatExecutableAsFullCommandLine()){
args = exe;
exe = "";
}
else{
std::vector<std::string> cl = onelabUtils::getCommandLine(_client);
for(unsigned int i = 0; i < cl.size(); i++)
args.append(" " + cl[i]);
}
args.append(" " + _client->getSocketSwitch() +
" \"" + _client->getName() + "\" %s");
}
......@@ -368,10 +374,10 @@ bool gmshLocalNetworkClient::receiveMessage(gmshLocalNetworkClient *master)
{
std::string::size_type first = 0;
std::string clientName = onelab::parameter::getNextToken(message, first);
std::string exe = onelab::parameter::getNextToken(message, first);
std::string command = onelab::parameter::getNextToken(message, first);
if (!onelab::server::instance()->isRegistered(clientName)){
gmshLocalNetworkClient* subClient =
new gmshLocalNetworkClient(clientName, exe);
new gmshLocalNetworkClient(clientName, command, "", true);
onelabGmshServer *server = new onelabGmshServer(subClient);
subClient->setPid(0);
int sock = server->LaunchClient();
......
......@@ -25,8 +25,10 @@ class gmshLocalNetworkClient : public onelab::localNetworkClient{
gmshLocalNetworkClient *_father;
public:
gmshLocalNetworkClient(const std::string &name, const std::string &executable,
const std::string &remoteLogin="")
: onelab::localNetworkClient(name, executable, remoteLogin), _father(0)
const std::string &remoteLogin="",
bool treatExecutableAsFullCommandLine=false)
: onelab::localNetworkClient(name, executable, remoteLogin,
treatExecutableAsFullCommandLine), _father(0)
{
addClient(this);
}
......
......@@ -1409,6 +1409,10 @@ namespace onelab{
private:
// executable of the client (including filesystem path, if necessary)
std::string _executable;
// treat the executable name as a full command line (will prevent the
// escaping of the exe name, and will assume that the command line has been
// correcly escaped)
bool _treatExecutableAsFullCommandLine;
// command to login to a remote host (if necessary)
std::string _remoteLogin;
// command line option to specify socket
......@@ -1419,14 +1423,21 @@ namespace onelab{
GmshServer *_gmshServer;
public:
localNetworkClient(const std::string &name, const std::string &executable,
const std::string &remoteLogin="")
: localClient(name), _executable(executable), _remoteLogin(remoteLogin),
_socketSwitch("-onelab"), _pid(-1), _gmshServer(0) {}
const std::string &remoteLogin="",
bool treatExecutableAsFullCommandLine=false)
: localClient(name), _executable(executable),
_treatExecutableAsFullCommandLine(treatExecutableAsFullCommandLine),
_remoteLogin(remoteLogin), _socketSwitch("-onelab"), _pid(-1),
_gmshServer(0) {}
virtual ~localNetworkClient(){}
virtual bool isNetworkClient(){ return true; }
const std::string &getExecutable(){ return _executable; }
void setExecutable(const std::string &s){ _executable = s; }
const std::string &getRemoteLogin(){ return _remoteLogin; }
const bool treatExecutableAsFullCommandLine()
{
return _treatExecutableAsFullCommandLine;
}
void setRemoteLogin(const std::string &s){ _remoteLogin = s; }
const std::string &getSocketSwitch(){ return _socketSwitch; }
void setSocketSwitch(const std::string &s){ _socketSwitch = s; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment