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 read on other forums that if main process does not wait for child process
to finish like using waitforfinished, then finished signal will not be sent
to main process, rather child process after finishing will become defunct
or zombie. In my code above, if I use waitforfinished, then main process
does receive finished signal.

*Is there any way by which main process can receive finished signal without
waiting for child process to finish?*

Regards,
Lata


-- 
*

*Lata Agrawal
Senior Developer
9699750643
En Route Media Pvt. Ltd.
*                                 *
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to