How to get the error code from a QProcess?
-
22-04-2021 - |
Frage
I have a function A()
in which I execute eight other 'sub-functions' which all include a QProcess
. How do I get the return codes from all the QProcesses?
Example:
void Mainclass::A()
{
B();
C();
// ...
I();
}
void Mainclass::B()
{
QString CommandPath = "PathB";
QProcess *Process = new QProcess(this);
Process->setWorkingDirectory(MainDir);
Process->setStandardOutputFile(MainDir + "/geometries");
Process->start(CommandPath);
Process->waitForFinished();
QProcess::ExitStatus Status = Process->exitStatus();
if (Status == 0)
{
std::cout << "App executed!" << std::endl;
}
}
I found this example but don't understand how to implement it myself because I use pointer objects in my application.
Lösung
Maybe int QProcess::exitCode () const
? See.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow