forked from qt-creator/qt-creator
StdIOClientInterface: Connect to done() signal
Instead of connecting to finished() signal. This should also handle a failed to start case. Change-Id: I000625adcceff94cf374cb2bfa9a994650cc261a Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -120,8 +120,12 @@ void StdIOClientInterface::startImpl()
|
||||
this, &StdIOClientInterface::readError);
|
||||
connect(m_process, &QtcProcess::readyReadStandardOutput,
|
||||
this, &StdIOClientInterface::readOutput);
|
||||
connect(m_process, &QtcProcess::finished, this, &StdIOClientInterface::onProcessFinished);
|
||||
connect(m_process, &QtcProcess::started, this, &StdIOClientInterface::started);
|
||||
connect(m_process, &QtcProcess::done, this, [this] {
|
||||
if (m_process->result() != ProcessResult::FinishedWithSuccess)
|
||||
emit error(m_process->exitMessage());
|
||||
emit finished();
|
||||
});
|
||||
m_process->setCommand(m_cmd);
|
||||
m_process->setWorkingDirectory(m_workingDirectory);
|
||||
m_process->setEnvironment(m_env);
|
||||
@@ -155,15 +159,6 @@ void StdIOClientInterface::sendData(const QByteArray &data)
|
||||
m_process->writeRaw(data);
|
||||
}
|
||||
|
||||
void StdIOClientInterface::onProcessFinished()
|
||||
{
|
||||
QTC_ASSERT(m_process, return);
|
||||
if (m_process->exitStatus() == QProcess::CrashExit)
|
||||
emit error(tr("Crashed with exit code %1: %2")
|
||||
.arg(m_process->exitCode()).arg(m_process->errorString()));
|
||||
emit finished();
|
||||
}
|
||||
|
||||
void StdIOClientInterface::readError()
|
||||
{
|
||||
QTC_ASSERT(m_process, return);
|
||||
|
@@ -97,7 +97,6 @@ protected:
|
||||
private:
|
||||
void readError();
|
||||
void readOutput();
|
||||
void onProcessFinished();
|
||||
};
|
||||
|
||||
} // namespace LanguageClient
|
||||
|
Reference in New Issue
Block a user