forked from qt-creator/qt-creator
Fix crash reporting in output pane when remote run in terminal
Fixes: QTCREATORBUG-27007 Change-Id: I6e409eb6489530dc6c48c90d20e28ff019eff187 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -60,8 +60,6 @@ SshRemoteProcess::SshRemoteProcess(const QString &command, const QStringList &co
|
||||
QString error;
|
||||
if (exitStatus() == QProcess::CrashExit)
|
||||
error = tr("The ssh process crashed: %1").arg(errorString());
|
||||
else if (exitCode() == 255)
|
||||
error = tr("Remote process crashed.");
|
||||
emit done(error);
|
||||
});
|
||||
connect(this, &QtcProcess::errorOccurred, [this](QProcess::ProcessError error) {
|
||||
|
||||
@@ -458,9 +458,6 @@ void ApplicationLauncherPrivate::handleApplicationFinished()
|
||||
if (exitCode != 0) {
|
||||
doReportError(ApplicationLauncher::tr("Application finished with exit code %1.")
|
||||
.arg(exitCode), QProcess::UnknownError);
|
||||
} else {
|
||||
emit q->appendMessage(ApplicationLauncher::tr("Application finished with exit code 0."),
|
||||
Utils::NormalMessageFormat);
|
||||
}
|
||||
}
|
||||
setFinished();
|
||||
|
||||
@@ -1196,6 +1196,7 @@ void SimpleTargetRunner::start()
|
||||
|
||||
void SimpleTargetRunner::doStart(const Runnable &runnable, const IDevice::ConstPtr &device)
|
||||
{
|
||||
m_stopForced = false;
|
||||
m_stopReported = false;
|
||||
m_launcher.disconnect(this);
|
||||
m_launcher.setUseTerminal(m_useTerminal);
|
||||
@@ -1205,19 +1206,6 @@ void SimpleTargetRunner::doStart(const Runnable &runnable, const IDevice::ConstP
|
||||
const QString msg = RunControl::tr("Starting %1...").arg(runnable.command.toUserOutput());
|
||||
appendMessage(msg, Utils::NormalMessageFormat);
|
||||
|
||||
if (isDesktop) {
|
||||
|
||||
connect(&m_launcher, &ApplicationLauncher::appendMessage,
|
||||
this, &SimpleTargetRunner::appendMessage);
|
||||
|
||||
connect(&m_launcher, &ApplicationLauncher::processStarted, this, [this] {
|
||||
// Console processes only know their pid after being started
|
||||
ProcessHandle pid = m_launcher.applicationPID();
|
||||
runControl()->setApplicationProcessHandle(pid);
|
||||
pid.activate();
|
||||
reportStarted();
|
||||
});
|
||||
|
||||
connect(&m_launcher, &ApplicationLauncher::processExited,
|
||||
this, [this, runnable](int exitCode, QProcess::ExitStatus status) {
|
||||
if (m_stopReported)
|
||||
@@ -1232,17 +1220,26 @@ void SimpleTargetRunner::doStart(const Runnable &runnable, const IDevice::ConstP
|
||||
|
||||
connect(&m_launcher, &ApplicationLauncher::error,
|
||||
this, [this, runnable](QProcess::ProcessError error) {
|
||||
if (m_stopReported)
|
||||
return;
|
||||
if (error == QProcess::Timedout)
|
||||
return; // No actual change on the process side.
|
||||
if (error != QProcess::Crashed) {
|
||||
const QString msg = userMessageForProcessError(
|
||||
error, runnable.command.executable());
|
||||
const QString msg = m_stopForced ? tr("The process was ended forcefully.")
|
||||
: userMessageForProcessError(error, runnable.command.executable());
|
||||
appendMessage(msg, Utils::NormalMessageFormat);
|
||||
}
|
||||
if (!m_stopReported) {
|
||||
m_stopReported = true;
|
||||
reportStopped();
|
||||
}
|
||||
});
|
||||
|
||||
connect(&m_launcher, &ApplicationLauncher::appendMessage, this, &RunWorker::appendMessage);
|
||||
|
||||
if (isDesktop) {
|
||||
connect(&m_launcher, &ApplicationLauncher::processStarted, this, [this] {
|
||||
// Console processes only know their pid after being started
|
||||
ProcessHandle pid = m_launcher.applicationPID();
|
||||
runControl()->setApplicationProcessHandle(pid);
|
||||
pid.activate();
|
||||
reportStarted();
|
||||
});
|
||||
|
||||
if (runnable.command.isEmpty()) {
|
||||
@@ -1252,27 +1249,14 @@ void SimpleTargetRunner::doStart(const Runnable &runnable, const IDevice::ConstP
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
connect(&m_launcher, &ApplicationLauncher::error, this, [this] {
|
||||
reportFailure(m_launcher.errorString());
|
||||
});
|
||||
|
||||
connect(&m_launcher, &ApplicationLauncher::processStarted, this, &RunWorker::reportStarted);
|
||||
|
||||
connect(&m_launcher, &ApplicationLauncher::processExited,
|
||||
this, [this] {
|
||||
m_launcher.disconnect(this);
|
||||
reportStopped();
|
||||
});
|
||||
|
||||
connect(&m_launcher, &ApplicationLauncher::appendMessage, this, &RunWorker::appendMessage);
|
||||
|
||||
m_launcher.start(runnable, device);
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleTargetRunner::stop()
|
||||
{
|
||||
m_stopForced = true;
|
||||
m_launcher.stop();
|
||||
}
|
||||
|
||||
@@ -1559,7 +1543,7 @@ QString RunWorker::userMessageForProcessError(QProcess::ProcessError error, cons
|
||||
"permissions to invoke the program.").arg(program.toUserOutput());
|
||||
break;
|
||||
case QProcess::Crashed:
|
||||
msg = tr("The process was ended forcefully.");
|
||||
msg = tr("The process crashed.");
|
||||
break;
|
||||
case QProcess::Timedout:
|
||||
// "The last waitFor...() function timed out. "
|
||||
|
||||
@@ -308,6 +308,7 @@ private:
|
||||
bool m_stopReported = false;
|
||||
bool m_useTerminal = false;
|
||||
bool m_runAsRoot = false;
|
||||
bool m_stopForced = false;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT OutputFormatterFactory
|
||||
|
||||
Reference in New Issue
Block a user