From 72e2df0c9512e95dc1fb4659fa204f88850f9f6a Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Mon, 13 Mar 2023 10:41:29 +0100 Subject: [PATCH] Qnx: Remove QnxProcessImpl The LinuxProcessImpl works better. Specifically the QnxProcessImpl process exit code would always return 0. Change-Id: I939d486e1cf7a1bdbb61a120a303d79e7cbce8e6 Reviewed-by: hjk --- src/plugins/qnx/qnxdevice.cpp | 62 ----------------------------------- src/plugins/qnx/qnxdevice.h | 1 - 2 files changed, 63 deletions(-) diff --git a/src/plugins/qnx/qnxdevice.cpp b/src/plugins/qnx/qnxdevice.cpp index f1770a55222..410d0397516 100644 --- a/src/plugins/qnx/qnxdevice.cpp +++ b/src/plugins/qnx/qnxdevice.cpp @@ -11,8 +11,6 @@ #include "qnxdevicewizard.h" #include "qnxtr.h" -#include - #include #include #include @@ -25,61 +23,6 @@ using namespace Utils; namespace Qnx::Internal { -class QnxProcessImpl final : public SshProcessInterface -{ -public: - QnxProcessImpl(const LinuxDevice *linuxDevice); - ~QnxProcessImpl() { killIfRunning(); } - -private: - QString fullCommandLine(const CommandLine &commandLine) const final; - void handleSendControlSignal(Utils::ControlSignal controlSignal) final; - - const QString m_pidFile; -}; - -static std::atomic_int s_pidFileCounter = 1; - -QnxProcessImpl::QnxProcessImpl(const LinuxDevice *linuxDevice) - : SshProcessInterface(linuxDevice) - , m_pidFile(QString("%1/qtc.%2.pid").arg(Constants::QNX_TMP_DIR).arg(s_pidFileCounter.fetch_add(1))) -{ -} - -QString QnxProcessImpl::fullCommandLine(const CommandLine &commandLine) const -{ - QStringList args = ProcessArgs::splitArgs(commandLine.arguments(), HostOsInfo::hostOs()); - args.prepend(commandLine.executable().toString()); - const QString cmd = ProcessArgs::createUnixArgs(args).toString(); - - QString fullCommandLine = - "test -f /etc/profile && . /etc/profile ; " - "test -f $HOME/profile && . $HOME/profile ; "; - - if (!m_setup.m_workingDirectory.isEmpty()) - fullCommandLine += QString::fromLatin1("cd %1 ; ").arg( - ProcessArgs::quoteArg(m_setup.m_workingDirectory.toString())); - - const Environment env = m_setup.m_environment; - env.forEachEntry([&](const QString &key, const QString &value, bool) { - fullCommandLine += QString("%1='%2' ").arg(key).arg(env.expandVariables(value)); - }); - - fullCommandLine += QString::fromLatin1("%1 & echo $! > %2").arg(cmd).arg(m_pidFile); - - return fullCommandLine; -} - -void QnxProcessImpl::handleSendControlSignal(Utils::ControlSignal controlSignal) -{ - QTC_ASSERT(controlSignal != ControlSignal::KickOff, return); - const QString args = QString::fromLatin1("-%1 `cat %2`") - .arg(controlSignalToInt(controlSignal)).arg(m_pidFile); - CommandLine command = { "kill", args, CommandLine::Raw }; - // Note: This blocking call takes up to 2 ms for local remote. - runInShell(command); -} - const char QnxVersionKey[] = "QnxVersion"; QnxDevice::QnxDevice() @@ -158,11 +101,6 @@ DeviceTester *QnxDevice::createDeviceTester() const return new QnxDeviceTester; } -Utils::ProcessInterface *QnxDevice::createProcessInterface() const -{ - return new QnxProcessImpl(this); -} - DeviceProcessSignalOperation::Ptr QnxDevice::signalOperation() const { return DeviceProcessSignalOperation::Ptr(new QnxDeviceProcessSignalOperation(sharedFromThis())); diff --git a/src/plugins/qnx/qnxdevice.h b/src/plugins/qnx/qnxdevice.h index f4efa3e1f25..0ee38912f37 100644 --- a/src/plugins/qnx/qnxdevice.h +++ b/src/plugins/qnx/qnxdevice.h @@ -20,7 +20,6 @@ public: ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const override; ProjectExplorer::DeviceTester *createDeviceTester() const override; - Utils::ProcessInterface *createProcessInterface() const override; int qnxVersion() const;