Merge pull request #33 from OtacilioNeto/master

Fix 100% CPU usage bug when listing users under FreeBSD.
This commit is contained in:
Ken Moore
2018-03-19 08:14:37 -04:00
committed by GitHub

View File

@@ -40,7 +40,10 @@ QString General::RunCommand(bool &success, QString command, QStringList argument
if(arguments.isEmpty()){ proc.start(command); }
else{ proc.start(command, arguments); }
//Wait for the process to finish (but don't block the event loop)
while( !proc.waitForFinished(500) ){ QCoreApplication::processEvents(); }
while( !proc.waitForFinished(500) ){
if(proc.state() != QProcess::Running){ break; } //somehow missed the finished signal
QCoreApplication::processEvents();
}
success = (proc.exitCode()==0); //return success/failure
return QString(proc.readAllStandardOutput());
}