Hi,
I'm on intership for a research lab, my duty is to provide a GUI for a good algorithm that until now needs to be launched and parametered console-style. I need to launch a heavy-processing shell script through GUI.
I use QtCreator 2.8.1 based on Qt 5.1.1, along with MinGW 4.8 and MSYS 1.0.17.
Yet I'm trying to launch the script through a QProcess with this syntax :
MainWindow.cpp
void MainWindow::on_pushButton_clicked() {
process
->setProcessChannelMode
(QProcess::MergedChannels);
connect(process, SIGNAL(readyReadStandardOutput()), this, SLOT(displayLog()));
QString command
= "sh ./myscript.sh";
process->start(command);
}
void MainWindow::on_pushButton_clicked() {
process = new QProcess(this);
process->setProcessChannelMode(QProcess::MergedChannels);
connect(process, SIGNAL(readyReadStandardOutput()), this, SLOT(displayLog()));
QString command = "sh ./myscript.sh";
process->start(command);
}
To copy to clipboard, switch view to plain text mode
With process declared as a QProcess*, displayLog() appending the output to a QPlainTextEdit and $PATH knowing MSYS/bin
The script runs, the log displays but in the stderr output it shows that at one point there's a memory allocation problem within one of the scripts crashing most of its functionnalities.
The nasty thing is that when I open cmd.exe and execute manually "sh ./myscript.sh", this allocation problem doesn't appear. I've tried to launch process->start("cmd /K start sh ./myscript.sh"), result is the same. Also with startDetached, everytime the script is launched through Qt it crashes.
My question is : is there a memory limitation for a QProcess on the heap ? Is there a way to extend the memory allocated to a QProcess ? What in the QProcess architecture could prevent a sh command to work the same as launched manually ? I've read the QProcess official doc aswell as many forum threads but couldn't find any hints, it's turning me crazy.
Thanks for your answers ! And overall thanks to the community, this forum is really useful on a daily-basis.
Edit: myscript.sh is a launcher that execute a bunch of others .sh, which end executing a fortran core algorithm.
Edit: the error message about a bad allocation is internally wrote in a script. It says : Allocation error var1->var2 in function COM_init.c, 805 306 368 bytes needed
Bookmarks