diff options
author | Eike Ziller <eike.ziller@qt.io> | 2018-01-05 07:58:39 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2018-01-06 11:08:15 +0000 |
commit | 6db6c04550d36a84ba3a8c3c95eafbdf4fba87d4 (patch) | |
tree | 6dfbbf017c8c5f9c4438f7f92b7880fdd4e57918 /plugins/haskell | |
parent | a76efd4cac4592a9534717051c3bba801767d8b2 (diff) |
Directly restart ghc-mod if it died between lookups
Before this patch it was trying to send the lookup to the dead ghc-mod
and found that it didn't get a timely answer, only restarting it after
that.
Change-Id: I15f39c14a753af4e0c94feeee7a0c3e390d5cf33
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'plugins/haskell')
-rw-r--r-- | plugins/haskell/ghcmod.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/haskell/ghcmod.cpp b/plugins/haskell/ghcmod.cpp index c2aa713..fbfabe7 100644 --- a/plugins/haskell/ghcmod.cpp +++ b/plugins/haskell/ghcmod.cpp @@ -114,8 +114,15 @@ Utils::optional<Error> GhcMod::ensureStarted() m_mutex.unlock(); Environment env = Environment::systemEnvironment(); const FileName stackExecutable = env.searchInPath(plainStackExecutable.toString()); - if (m_process && FileName::fromString(m_process->program()) != stackExecutable) - shutdown(); + if (m_process) { + if (m_process->state() == QProcess::NotRunning) { + log("is no longer running"); + m_process.reset(); + } else if (FileName::fromString(m_process->program()) != stackExecutable) { + log("stack settings changed"); + shutdown(); + } + } if (m_process) return Utils::nullopt; log("starting"); @@ -173,7 +180,7 @@ QByteArrayOrError GhcMod::runQuery(const QString &query) qCDebug(ghcModLog) << "response" << QTextCodec::codecForLocale()->toUnicode(response); if (!ok) { log("failed"); - m_process.reset(); + shutdown(); return Error({Error::Type::Other, QString()}); } log("success"); |