forked from qt-creator/qt-creator
Fix closing remote linux applications
When the remote application was run in terminal it was still marked as running in application output pane after it has finished (the red square button was enabled). This patch fixes it. Stop the terminate timeout when stop was executed by user (application output -> Stop running program) after successful termination (so that instead of: "Timeout waiting for remote process to finish." we see now: "The process was ended forcefully."). Fixes: QTCREATORBUG-26848 Change-Id: I2dfeccc60fb12388cb9dcfd56bd2aa2c5383209b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -462,12 +462,8 @@ void ApplicationLauncherPrivate::setFinished()
|
||||
return;
|
||||
|
||||
int exitCode = 0;
|
||||
if (m_deviceProcess) {
|
||||
if (m_deviceProcess)
|
||||
exitCode = m_deviceProcess->exitCode();
|
||||
m_deviceProcess->disconnect(this);
|
||||
m_deviceProcess->deleteLater();
|
||||
m_deviceProcess = nullptr;
|
||||
}
|
||||
|
||||
m_state = Inactive;
|
||||
emit q->processExited(exitCode, m_remoteExitStatus);
|
||||
|
@@ -119,16 +119,14 @@ void SshDeviceProcess::interrupt()
|
||||
|
||||
void SshDeviceProcess::terminate()
|
||||
{
|
||||
QTC_ASSERT(d->state == SshDeviceProcessPrivate::ProcessRunning, return);
|
||||
d->doSignal(Signal::Terminate);
|
||||
if (runInTerminal())
|
||||
d->consoleProcess.stop();
|
||||
}
|
||||
|
||||
void SshDeviceProcess::kill()
|
||||
{
|
||||
QTC_ASSERT(d->state == SshDeviceProcessPrivate::ProcessRunning, return);
|
||||
d->doSignal(Signal::Kill);
|
||||
if (runInTerminal())
|
||||
d->consoleProcess.stop();
|
||||
}
|
||||
|
||||
QProcess::ProcessState SshDeviceProcess::state() const
|
||||
@@ -199,6 +197,8 @@ void SshDeviceProcess::handleConnected()
|
||||
this, &DeviceProcess::error);
|
||||
connect(&d->consoleProcess, &ConsoleProcess::processStarted,
|
||||
this, &SshDeviceProcess::handleProcessStarted);
|
||||
connect(&d->consoleProcess, &ConsoleProcess::processStopped,
|
||||
this, [this] { handleProcessFinished(d->consoleProcess.errorString()); });
|
||||
connect(&d->consoleProcess, &ConsoleProcess::stubStopped,
|
||||
this, [this] { handleProcessFinished(d->consoleProcess.errorString()); });
|
||||
d->consoleProcess.setAbortOnMetaChars(false);
|
||||
@@ -256,6 +256,8 @@ void SshDeviceProcess::handleProcessFinished(const QString &error)
|
||||
{
|
||||
d->errorMessage = error;
|
||||
d->exitCode = runInTerminal() ? d->consoleProcess.exitCode() : d->process->exitCode();
|
||||
if (d->killOperation && error.isEmpty())
|
||||
d->errorMessage = tr("The process was ended forcefully.");
|
||||
d->setState(SshDeviceProcessPrivate::Inactive);
|
||||
emit finished();
|
||||
}
|
||||
@@ -357,6 +359,8 @@ void SshDeviceProcess::SshDeviceProcessPrivate::setState(SshDeviceProcess::SshDe
|
||||
if (killOperation) {
|
||||
killOperation->disconnect(q);
|
||||
killOperation.clear();
|
||||
if (q->runInTerminal())
|
||||
QMetaObject::invokeMethod(&consoleProcess, &ConsoleProcess::stop, Qt::QueuedConnection);
|
||||
}
|
||||
killTimer.stop();
|
||||
consoleProcess.disconnect();
|
||||
|
@@ -40,12 +40,8 @@ RemoteLinuxSignalOperation::RemoteLinuxSignalOperation(
|
||||
|
||||
RemoteLinuxSignalOperation::~RemoteLinuxSignalOperation()
|
||||
{
|
||||
if (m_runner) {
|
||||
connect(m_runner, &QSsh::SshRemoteProcessRunner::processClosed,
|
||||
m_runner, &QSsh::SshRemoteProcessRunner::deleteLater);
|
||||
connect(m_runner, &QSsh::SshRemoteProcessRunner::connectionError,
|
||||
m_runner, &QSsh::SshRemoteProcessRunner::deleteLater);
|
||||
}
|
||||
if (m_runner)
|
||||
m_runner->deleteLater();
|
||||
}
|
||||
|
||||
static QString signalProcessGroupByPidCommandLine(qint64 pid, int signal)
|
||||
|
Reference in New Issue
Block a user