aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor/generichighlighter/highlightersettings.cpp
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2016-04-29 16:52:58 +0200
committerTobias Hunger <tobias.hunger@qt.io>2016-05-11 10:04:38 +0000
commitddefe062c73e35def585f8fc6c90a4f18e47c0f4 (patch)
tree03c3aecc501c03b92e259fe0ae1c4d472033b7e5 /src/plugins/texteditor/generichighlighter/highlightersettings.cpp
parent1a248b1b932e2c7c42e25993d921e78c52aa4bcf (diff)
Fix up QProcess::waitForFinished()
waitForFinish returns false if the process is no longer running at the time of the call. Handle that throughout the codebase. Change-Id: Ia7194095454e82efbd4eb88f2d55926bdd09e094 Reviewed-by: hjk <hjk@theqtcompany.com>
Diffstat (limited to 'src/plugins/texteditor/generichighlighter/highlightersettings.cpp')
-rw-r--r--src/plugins/texteditor/generichighlighter/highlightersettings.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/plugins/texteditor/generichighlighter/highlightersettings.cpp b/src/plugins/texteditor/generichighlighter/highlightersettings.cpp
index 1231bd41a5..545d04101c 100644
--- a/src/plugins/texteditor/generichighlighter/highlightersettings.cpp
+++ b/src/plugins/texteditor/generichighlighter/highlightersettings.cpp
@@ -27,13 +27,13 @@
#include <coreplugin/icore.h>
#include <utils/hostosinfo.h>
+#include <utils/synchronousprocess.h>
#include <QSettings>
#include <QLatin1String>
#include <QLatin1Char>
#include <QDir>
#include <QFile>
-#include <QProcess>
#include <QStringList>
namespace TextEditor {
@@ -69,11 +69,12 @@ QString findFallbackDefinitionsLocation()
QStringList programs;
programs << QLatin1String("kde-config") << QLatin1String("kde4-config");
foreach (const QString &program, programs) {
- QProcess process;
- process.start(program, QStringList(QLatin1String("--prefix")));
- if (process.waitForStarted(5000)) {
- process.waitForFinished(5000);
- QString output = QString::fromLocal8Bit(process.readAllStandardOutput());
+ Utils::SynchronousProcess process;
+ process.setTimeoutS(5);
+ Utils::SynchronousProcessResponse response
+ = process.run(program, QStringList(QLatin1String("--prefix")));
+ if (response.result == Utils::SynchronousProcessResponse::Finished) {
+ QString output = response.stdOut;
output.remove(QLatin1Char('\n'));
for (int i = 0; i < kateSyntaxCount; ++i) {
dir.setPath(output + kateSyntax[i]);