From f01ebebb938bec2b27558b04f342d8fc2ef9014f Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 4 Feb 2022 10:27:56 +0100 Subject: [PATCH] ProjectExplorer: Use plain QtcProcess in DeviceUsedPortsGatherer Instead of DeviceProcess. Change-Id: I0e1dedf63faad7dbfca5b6c58fbfe72c7ef2c052 Reviewed-by: hjk --- .../devicesupport/deviceusedportsgatherer.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.cpp b/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.cpp index 93ab54bd64d..d2fd04125e3 100644 --- a/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.cpp +++ b/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.cpp @@ -74,8 +74,8 @@ void DeviceUsedPortsGatherer::start(const IDevice::ConstPtr &device) QTC_ASSERT(d->portsGatheringMethod, emit error("Not implemented"); return); const QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::AnyIPProtocol; - d->process.reset(d->device->createProcess(this)); + d->process.reset(new QtcProcess); connect(d->process.get(), &QtcProcess::done, this, &DeviceUsedPortsGatherer::handleProcessDone); connect(d->process.get(), &QtcProcess::readyReadStandardOutput, @@ -83,7 +83,10 @@ void DeviceUsedPortsGatherer::start(const IDevice::ConstPtr &device) connect(d->process.get(), &QtcProcess::readyReadStandardError, this, [this] { d->remoteStderr += d->process->readAllStandardError(); }); - d->process->setCommand(d->portsGatheringMethod->commandLine(protocol)); + CommandLine command = d->portsGatheringMethod->commandLine(protocol); + const FilePath executable = d->device->mapToGlobalPath(command.executable()); + command.setExecutable(executable); + d->process->setCommand(command); d->process->start(); } @@ -116,7 +119,7 @@ void DeviceUsedPortsGatherer::setupUsedPorts() { d->usedPorts.clear(); const QList usedPorts = d->portsGatheringMethod->usedPorts(d->remoteStdout); - foreach (const Port port, usedPorts) { + for (const Port port : usedPorts) { if (d->device->freePorts().contains(port)) d->usedPorts << port; }