Commit 5b8d1646 authored by Philip Müller's avatar Philip Müller Committed by GitHub

Merge pull request #141 from manjaro/fix_#140

fix #140
parents b4945364 b329c132
......@@ -25,12 +25,19 @@
ActionReply
MhwdAuthHelper::install( const QVariantMap& args )
{
QProcess mhwd;
mhwd.start( "/usr/bin/mhwd", args["arguments"].toStringList() );
connect( &mhwd, &QProcess::readyRead,
actionReply = ActionReply::SuccessType;
QProcess* mhwd = new QProcess();
mhwd->start( "/usr/bin/mhwd", args["arguments"].toStringList() );
connect( mhwd, &QProcess::readyRead,
[&] ()
{
QString data = QString::fromUtf8( mhwd.readAll() ).trimmed();
QString data = QString::fromUtf8( mhwd->readAllStandardOutput() ).trimmed();
QString dataErr = QString::fromUtf8( mhwd->readAllStandardError() ).trimmed();
if ( !dataErr.isEmpty() )
{
actionReply = ActionReply::HelperErrorType;
data.append( "\n" ).append( dataErr );
}
if ( !data.isEmpty() )
{
QVariantMap map;
......@@ -39,13 +46,16 @@ MhwdAuthHelper::install( const QVariantMap& args )
}
} );
if ( !mhwd.waitForStarted() )
return ActionReply::HelperErrorReply();
mhwd->waitForStarted();
mhwd->waitForFinished( -1 );
if ( !mhwd.waitForFinished( 600000 ) )
return ActionReply::HelperErrorReply();
return ActionReply::SuccessReply();
/* need to check as mhwd doesn't output errors in Standard Error */
if( mhwd->exitCode() != 0 )
{
actionReply = ActionReply::HelperErrorType;
actionReply.setError( mhwd->exitCode() );
}
return actionReply;
}
......
......@@ -50,6 +50,9 @@ public Q_SLOTS:
* fails
*/
ActionReply remove( const QVariantMap& args );
private:
ActionReply actionReply;
};
#endif // MHWDAUTHHELPER_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment