Qnx: Merge qnxdeviceprocesssignaloperation.{h,cpp} into qnxdevice.cpp

Not worth a file pair anymore.

Change-Id: I86afff84586592dd05d40e573e6b9a95c54913fe
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2023-03-13 15:03:33 +01:00
parent 72e2df0c95
commit 4f8ad43c1e
5 changed files with 31 additions and 62 deletions

View File

@@ -7,10 +7,11 @@
#include "qnxdeployqtlibrariesdialog.h"
#include "qnxdevicetester.h"
#include "qnxdeviceprocesslist.h"
#include "qnxdeviceprocesssignaloperation.h"
#include "qnxdevicewizard.h"
#include "qnxtr.h"
#include <remotelinux/remotelinuxsignaloperation.h>
#include <utils/port.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
@@ -25,6 +26,35 @@ namespace Qnx::Internal {
const char QnxVersionKey[] = "QnxVersion";
static QString signalProcessByNameQnxCommandLine(const QString &filePath, int sig)
{
QString executable = filePath;
return QString::fromLatin1("for PID in $(ps -f -o pid,comm | grep %1 | awk '/%1/ {print $1}'); "
"do "
"kill -%2 $PID; "
"done").arg(executable.replace(QLatin1String("/"), QLatin1String("\\/"))).arg(sig);
}
class QnxDeviceProcessSignalOperation : public RemoteLinuxSignalOperation
{
public:
explicit QnxDeviceProcessSignalOperation(const IDeviceConstPtr &device)
: RemoteLinuxSignalOperation(device)
{}
QString killProcessByNameCommandLine(const QString &filePath) const override
{
return QString::fromLatin1("%1; %2").arg(signalProcessByNameQnxCommandLine(filePath, 15),
signalProcessByNameQnxCommandLine(filePath, 9));
}
QString interruptProcessByNameCommandLine(const QString &filePath) const override
{
return signalProcessByNameQnxCommandLine(filePath, 2);
}
};
QnxDevice::QnxDevice()
{
setDisplayType(Tr::tr("QNX"));