Hi kde-devel,

I'm trying to convert my package manager frontend to KAuth so it doesn't have 
to be run under kdesu but my helper doesn't seem to be behaving and I'm having 
trouble debugging it.  The helper code right now is:
ActionReply KurooHelper::sync( const QVariantMap& args )
{
        if ( NULL != syncProc ) {
                syncProc->close();
                syncProc->clearProgram();
        } else {
                syncProc = new KProcess();
        syncProc->setEnv( "PATH", args["PATH"].toString() );
                //use merged mode because emerge seems to output everything on 
stdout when there's any error (like a slot conflict)
                //including all the useful information
                syncProc->setOutputChannelMode( KProcess::MergedChannels );
        }

        *syncProc << "emerge" << "--sync" << "--quiet" << "--color=n" << 
"--nospinner";

        connect(syncProc, &KProcess::readyReadStandardOutput, this, 
&KurooHelper::slotEmergeOutput);
        syncProc->start();
    syncProc->waitForStarted( 5000 );

        qDebug() << "Started sync";
        while ( QProcess::Running == syncProc->state() || QProcess:Starting == 
syncProc->state() ) {
                if ( HelperSupport::isStopped() ) {
                        qDebug() << "Sync cancelled by user";
                        syncProc->kill();
                        return ActionReply::UserCancelledReply();
                }
                sleep( 10 );
                qDebug() << "Sync tick";
        }
        qDebug() << "Sync process is no longer running, status is now " << 
syncProc->state();
    slotEmergeOutput();
        return ActionReply::SuccessReply();

}

void KurooHelper::slotEmergeOutput()
{
        QByteArray data = syncProc->readAllStandardOutput();
        QVariantMap retVal;
        retVal["output"] = data;
        KAuth::HelperSupport::progressStep( retVal );
}


This call is expected to be long-running, hence the ugly while () in there, but 
it never returns any output and doesn't take as long as it should.  Is there 
any way I can get better debugging output to see what is happening?

Thanks,
-Amber

Reply via email to