Fix 100% CPU usage bug when listing users under FreeBSD.

This commit is contained in:
Otacílio
2018-03-18 22:52:13 -03:00
parent fd5504b304
commit d7c4e29d9a

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());
}