PDA

View Full Version : QProcess finishes but never emits finished signal



BettaUseYoNikes
2nd December 2011, 18:15
My QProcess which is the command line version of my application that I am designing a GUI has really weird behaviour.
These are the signals I connect before starting the QProcess. What is happening is when the process has a problem like being unable to open the input file, the QProcess does not actually finish or exit. When looking at CPU usage the QProcess stays open but dormant at 0% usage.

connect(CGC, SIGNAL(started()), this, SLOT(SV_CGC_Started()));
connect(CGC, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(SV_CGC_Ended(int,QProcess::ExitStatus)));
connect(CGC, SIGNAL(readyRead()), this, SLOT(SV_CGC_readyRead()));
CGC->start(program,arguments);

Very stumped on this one.

stampede
3rd December 2011, 08:00
when the process has a problem like being unable to open the input file, the QProcess does not actually finish or exit.
You said that this is your application, so its your responsibility to implement such behavior. You need to return from main() or call exit(int) to close the command line application, then the associated process will be finished.

Oleg
3rd December 2011, 08:01
How QProcess can emit finished signal if it really doesn't finish? Make your QProcess code exit in case of any error.