diff --git a/src/plugins/qnx/CMakeLists.txt b/src/plugins/qnx/CMakeLists.txt index 66dd7058770..2c0e77cee8c 100644 --- a/src/plugins/qnx/CMakeLists.txt +++ b/src/plugins/qnx/CMakeLists.txt @@ -11,7 +11,6 @@ add_qtc_plugin(Qnx qnxdeployqtlibrariesdialog.cpp qnxdeployqtlibrariesdialog.h qnxdevice.cpp qnxdevice.h qnxdeviceprocesslist.cpp qnxdeviceprocesslist.h - qnxdeviceprocesssignaloperation.cpp qnxdeviceprocesssignaloperation.h qnxdevicetester.cpp qnxdevicetester.h qnxdevicewizard.cpp qnxdevicewizard.h qnxplugin.cpp diff --git a/src/plugins/qnx/qnx.qbs b/src/plugins/qnx/qnx.qbs index 0389f542a65..b9e19ead0b1 100644 --- a/src/plugins/qnx/qnx.qbs +++ b/src/plugins/qnx/qnx.qbs @@ -32,8 +32,6 @@ QtcPlugin { "qnxdevicewizard.h", "qnxdeviceprocesslist.cpp", "qnxdeviceprocesslist.h", - "qnxdeviceprocesssignaloperation.cpp", - "qnxdeviceprocesssignaloperation.h", "qnxdevicetester.cpp", "qnxdevicetester.h", "qnxconfigurationmanager.cpp", diff --git a/src/plugins/qnx/qnxdevice.cpp b/src/plugins/qnx/qnxdevice.cpp index 410d0397516..958f09a59e5 100644 --- a/src/plugins/qnx/qnxdevice.cpp +++ b/src/plugins/qnx/qnxdevice.cpp @@ -7,10 +7,11 @@ #include "qnxdeployqtlibrariesdialog.h" #include "qnxdevicetester.h" #include "qnxdeviceprocesslist.h" -#include "qnxdeviceprocesssignaloperation.h" #include "qnxdevicewizard.h" #include "qnxtr.h" +#include + #include #include #include @@ -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")); diff --git a/src/plugins/qnx/qnxdeviceprocesssignaloperation.cpp b/src/plugins/qnx/qnxdeviceprocesssignaloperation.cpp deleted file mode 100644 index 56df01d8a9e..00000000000 --- a/src/plugins/qnx/qnxdeviceprocesssignaloperation.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2016 BlackBerry Limited. All rights reserved. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#include "qnxdeviceprocesssignaloperation.h" - -namespace Qnx::Internal { - -QnxDeviceProcessSignalOperation::QnxDeviceProcessSignalOperation( - const ProjectExplorer::IDeviceConstPtr &device) - : RemoteLinux::RemoteLinuxSignalOperation(device) -{ -} - -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); -} - -QString QnxDeviceProcessSignalOperation::killProcessByNameCommandLine( - const QString &filePath) const -{ - return QString::fromLatin1("%1; %2").arg(signalProcessByNameQnxCommandLine(filePath, 15), - signalProcessByNameQnxCommandLine(filePath, 9)); -} - -QString QnxDeviceProcessSignalOperation::interruptProcessByNameCommandLine( - const QString &filePath) const -{ - return signalProcessByNameQnxCommandLine(filePath, 2); -} - -} // Qnx::Internal diff --git a/src/plugins/qnx/qnxdeviceprocesssignaloperation.h b/src/plugins/qnx/qnxdeviceprocesssignaloperation.h deleted file mode 100644 index 271aea6a4e0..00000000000 --- a/src/plugins/qnx/qnxdeviceprocesssignaloperation.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2016 BlackBerry Limited. All rights reserved. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#pragma once - -#include - -namespace Qnx::Internal { - -class QnxDeviceProcessSignalOperation : public RemoteLinux::RemoteLinuxSignalOperation -{ -protected: - explicit QnxDeviceProcessSignalOperation(const ProjectExplorer::IDeviceConstPtr &device); - -private: - QString killProcessByNameCommandLine(const QString &filePath) const override; - QString interruptProcessByNameCommandLine(const QString &filePath) const override; - - friend class QnxDevice; -}; - -} // Qnx::Internal