[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    KAuth helper trouble
From:       Amber Schenck <ambersck () hotmail ! com>
Date:       2018-04-25 19:33:25
Message-ID: MWHPR22MB0141956BDFCB707A5E9FFCDFCD8F0 () MWHPR22MB0141 ! namprd22 ! prod ! outlook ! com
[Download RAW message or body]

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=


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic