forked from qt-creator/qt-creator
ProjectExplorer: Consolidate ApplicationLauncher error access
Change-Id: I2f6dd54685c2c148f78f9853fd1d93a311eb16bb Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -216,9 +216,9 @@ qint64 ApplicationLauncherPrivate::applicationPID() const
|
||||
return m_process.processId();
|
||||
}
|
||||
|
||||
QString ApplicationLauncher::errorString() const
|
||||
ProcessResultData ApplicationLauncher::resultData() const
|
||||
{
|
||||
return d->m_resultData.m_errorString;
|
||||
return d->m_resultData;
|
||||
}
|
||||
|
||||
void ApplicationLauncherPrivate::handleDone()
|
||||
@@ -285,21 +285,6 @@ void ApplicationLauncherPrivate::handleStandardError()
|
||||
emit q->appendMessage(msg, StdErrFormat, false);
|
||||
}
|
||||
|
||||
int ApplicationLauncher::exitCode() const
|
||||
{
|
||||
return d->m_resultData.m_exitCode;
|
||||
}
|
||||
|
||||
QProcess::ExitStatus ApplicationLauncher::exitStatus() const
|
||||
{
|
||||
return d->m_resultData.m_exitStatus;
|
||||
}
|
||||
|
||||
QProcess::ProcessError ApplicationLauncher::error() const
|
||||
{
|
||||
return d->m_resultData.m_error;
|
||||
}
|
||||
|
||||
void ApplicationLauncher::start()
|
||||
{
|
||||
d->start();
|
||||
|
@@ -34,7 +34,10 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Utils { class ProcessHandle; }
|
||||
namespace Utils {
|
||||
class ProcessHandle;
|
||||
class ProcessResultData;
|
||||
} // Utils
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
@@ -57,13 +60,10 @@ public:
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
Utils::ProcessHandle applicationPID() const;
|
||||
|
||||
QString errorString() const;
|
||||
|
||||
int exitCode() const;
|
||||
QProcess::ExitStatus exitStatus() const;
|
||||
QProcess::ProcessError error() const;
|
||||
Utils::ProcessResultData resultData() const;
|
||||
|
||||
signals:
|
||||
void appendMessage(const QString &message, Utils::OutputFormat format, bool appendNewLine = true);
|
||||
|
@@ -44,6 +44,7 @@
|
||||
#include <utils/detailswidget.h>
|
||||
#include <utils/fileinprojectfinder.h>
|
||||
#include <utils/outputformatter.h>
|
||||
#include <utils/processinterface.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/utilsicons.h>
|
||||
#include <utils/variablechooser.h>
|
||||
@@ -1224,13 +1225,14 @@ void SimpleTargetRunner::doStart(const Runnable &runnable)
|
||||
if (m_stopReported)
|
||||
return;
|
||||
const QString executable = runnable.command.executable().toUserOutput();
|
||||
QString msg = tr("%2 exited with code %1").arg(m_launcher.exitCode()).arg(executable);
|
||||
if (m_launcher.exitStatus() == QProcess::CrashExit)
|
||||
const ProcessResultData resultData = m_launcher.resultData();
|
||||
QString msg = tr("%2 exited with code %1").arg(resultData.m_exitCode).arg(executable);
|
||||
if (resultData.m_exitStatus == QProcess::CrashExit)
|
||||
msg = tr("%1 crashed.").arg(executable);
|
||||
else if (m_stopForced)
|
||||
msg = tr("The process was ended forcefully.");
|
||||
else if (m_launcher.error() != QProcess::UnknownError)
|
||||
msg = userMessageForProcessError(m_launcher.error(), runnable.command.executable());
|
||||
else if (resultData.m_error != QProcess::UnknownError)
|
||||
msg = userMessageForProcessError(resultData.m_error, runnable.command.executable());
|
||||
const QString displayName = runnable.command.executable().toUserOutput();
|
||||
appendMessage(msg.arg(displayName), Utils::NormalMessageFormat);
|
||||
m_stopReported = true;
|
||||
|
Reference in New Issue
Block a user