LinuxDevice: Fix stopping remote app when run in terminal

Before, the SshProcessInterface was trying to run kill
command (on remote host) for the running processId. However,
in case of terminal process the returned processId is an id
of ssh running through creator process stub, not the id of
remote process. The fix is to redirect a call to sendControlSignal
into the internal terminal process.

Change-Id: I57509fd61a54c335ab0a34f8ca0dffb3d75da696
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-11-14 15:23:01 +01:00
parent 35a37c3450
commit adac83367c
5 changed files with 22 additions and 7 deletions

View File

@@ -496,6 +496,20 @@ qint64 SshProcessInterface::write(const QByteArray &data)
return d->m_process.writeRaw(data);
}
void SshProcessInterface::sendControlSignal(Utils::ControlSignal controlSignal)
{
if (d->m_process.usesTerminal()) {
switch (controlSignal) {
case Utils::ControlSignal::Terminate: d->m_process.terminate(); break;
case Utils::ControlSignal::Kill: d->m_process.kill(); break;
case Utils::ControlSignal::Interrupt: d->m_process.interrupt(); break;
case Utils::ControlSignal::KickOff: d->m_process.kickoffProcess(); break;
}
return;
}
handleSendControlSignal(controlSignal);
}
LinuxProcessInterface::LinuxProcessInterface(const LinuxDevice *linuxDevice)
: SshProcessInterface(linuxDevice)
{
@@ -506,7 +520,7 @@ LinuxProcessInterface::~LinuxProcessInterface()
killIfRunning();
}
void LinuxProcessInterface::sendControlSignal(ControlSignal controlSignal)
void LinuxProcessInterface::handleSendControlSignal(ControlSignal controlSignal)
{
QTC_ASSERT(controlSignal != ControlSignal::KickOff, return);
const qint64 pid = processId();