I have an issues trying to launch firefox through QProcess. Here is the function I used to launch commands (such as firefox, mkdir, ...)
double launch_nowait(string cmd, bool display) {
string command_name = "";
string command_param = "";
bool first_space = false;
for (int p = 0; p < cmd.size(); p++) {
if (!first_space && cmd[p] == ' ') first_space = true;
else {
if (!first_space) command_name += cmd[p];
else command_param += cmd[p];
}
}
cout << "NOWAIT [" << command_name << "][" << command_param << "]" << endl;
QProcess* process;
//process->setWorkingDirectory(".");
//process->waitForFinished();
process->start(QString::fromStdString(command_name), QStringList() << QString::fromStdString(command_param));
return 0;
}
I tried several things such as :
- removing parameters,
- changing the navigator to chrome
- adding a wait
- setting the working directory
But it always ends with a seg fault.
The strange thing is that when I use this function to create a directory it works fine.
Thanks for your help,