[Development] No Finished signal from QProcess!

lata agrawal lata07agrawal at gmail.com
Mon Feb 27 20:32:25 CET 2012


Hi Thiago,

Thanks for replying. After reading on net, I found that "even if child
process finishes and parent process is not waiting for the child process to
finish, then parent process will not receive a finished signal. rather in
this case, child process will become a zombie".
I checked that after using waitforfinished(), I was getting finished
signal. I will send you minimal compilable code.
Is there any solution where I can get finished signal from child process
without waiting for it.

Regards,
Lata

On Tue, Feb 28, 2012 at 12:40 AM, 1+1=2 <dbzhang800 at gmail.com> wrote:

> Hi,
>
> please use
>  return a.exec();
> instead of
>  return 0;
>
> Debao
>
> 2012/2/27 lata agrawal <lata07agrawal at gmail.com>:
> > Hi,
> >
> > I am running console application C1 in QProcess. I am starting this
> console
> > application C1 from another console application C2. Problem is:
> >
> > I am only getting finished signal from C1 when I use waitforfinshed()
> else I
> > am not getting finished signal from C1. Here is the code:
> >
> >                 QString strProgram;
> >                 strProgram = <Path to C1>;
> >
> > updateProc->setProcessChannelMode(QProcess::ForwardedChannels);
> >                 connect(updateProc,
> > SIGNAL(finished(int,QProcess::ExitStatus)),
> > SLOT(procStarted(int,QProcess::ExitStatus)), Qt::DirectConnection);
> >
> > updateProc->setStandardOutputProcess(this->thread()->parent());
> >                 updateProc->start(strProgram, arguments);
> >
> >                 Download is over, indicate through bool variable that
> next
> > downlaod can be started
> >                 if(updateProc->waitForFinished(-1))
> >                 {
> >                     qDebug("Update process finished!\n");
> >                 }
> >                 else
> >                 {
> >                     qDebug("Update process not yet finished!\n");
> >                 }
> >
> > void FloDownloadManager::procStarted(int retVal ,QProcess::ExitStatus
> > exitStat)
> > {
> >     qDebug("Update process finished automatically!\n");
> >     if(currentExecutingPriority == AdsUpdate)
> >     {
> >         emit adUpdateDone();
> >     }
> >     blnStartNextUpdate = true;
> >
> >     updateProc->deleteLater();
> > }
> >
> >
> > If I comment the waitforfinished() code, I don't get the finished signal.
> > But if I include the waitforfinished() signal, I don't get the finished
> > signal. Code for C1 is as follows:
> >
> > #include <QtCore/QCoreApplication>
> > #include "updater.h"
> >
> > int main(int argc, char *argv[])
> > {
> >     QCoreApplication a(argc, argv);
> >
> >     qDebug("Inside Updater\n");
> >
> >     QTimer::singleShot(5000, &a, SLOT(quit()));
> >     qDebug("returning from Updater process!@@@@@@@@\n");
> >
> >     return 0;
> > }
> >
> > I fail to understand what is going on wrong here. Someone please help.
> >
> > Regards,
> > Lata
> >
> > _______________________________________________
> > Development mailing list
> > Development at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/development
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120228/c49ca94a/attachment.html>


More information about the Development mailing list