Hi Guys,
I have question about QProcess exitStatus() method. I am using QProcess to communicate with external program bash script. The bash script gives me return code of either 0,2 or 3. Now I want to test some conditions based on qprocess output. Once processExited() signal triggers it will connect to processDone() slot. Can QProcess returns the exit code of any digit other than 0. I noticed when my script gives me exit code of 2 or 3..I get crash as soon as processDone() get called. It looks like I can not verify the exit status of Qprocess other than using digit 0. I could have used readLineStdOut( ) to read output value but I dont want to get returned string value. How do I get exit status if return code from external program is numeric digit other than just 0.
I am using Qt3.
connect ( myProcess , SIGNAL ( processExited()) , this , SLOT ( processDone ( ) ) );
void MainWindow::processDone()
{
if ( myProcess->exitStatus() == 0)
{
qDebug () << "Program ran successfully";
}
if ( myProcess->exitStatus() == 2)
{
qDebug () << "Customized message";
}
if ( myProcess->exitStatus() == 3)
{
qDebug () << "Another text warning message";
}
}
connect ( myProcess , SIGNAL ( processExited()) , this , SLOT ( processDone ( ) ) );
void MainWindow::processDone()
{
if ( myProcess->exitStatus() == 0)
{
qDebug () << "Program ran successfully";
}
if ( myProcess->exitStatus() == 2)
{
qDebug () << "Customized message";
}
if ( myProcess->exitStatus() == 3)
{
qDebug () << "Another text warning message";
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks