ProjectExplorer: Use plain QtcProcess in DeviceUsedPortsGatherer

Instead of DeviceProcess.

Change-Id: I0e1dedf63faad7dbfca5b6c58fbfe72c7ef2c052
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
hjk
2022-02-04 10:27:56 +01:00
committed by Jarek Kobus
parent aa3bdcb427
commit f01ebebb93

View File

@@ -74,8 +74,8 @@ void DeviceUsedPortsGatherer::start(const IDevice::ConstPtr &device)
QTC_ASSERT(d->portsGatheringMethod, emit error("Not implemented"); return); QTC_ASSERT(d->portsGatheringMethod, emit error("Not implemented"); return);
const QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::AnyIPProtocol; const QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::AnyIPProtocol;
d->process.reset(d->device->createProcess(this));
d->process.reset(new QtcProcess);
connect(d->process.get(), &QtcProcess::done, connect(d->process.get(), &QtcProcess::done,
this, &DeviceUsedPortsGatherer::handleProcessDone); this, &DeviceUsedPortsGatherer::handleProcessDone);
connect(d->process.get(), &QtcProcess::readyReadStandardOutput, connect(d->process.get(), &QtcProcess::readyReadStandardOutput,
@@ -83,7 +83,10 @@ void DeviceUsedPortsGatherer::start(const IDevice::ConstPtr &device)
connect(d->process.get(), &QtcProcess::readyReadStandardError, connect(d->process.get(), &QtcProcess::readyReadStandardError,
this, [this] { d->remoteStderr += d->process->readAllStandardError(); }); 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(); d->process->start();
} }
@@ -116,7 +119,7 @@ void DeviceUsedPortsGatherer::setupUsedPorts()
{ {
d->usedPorts.clear(); d->usedPorts.clear();
const QList<Port> usedPorts = d->portsGatheringMethod->usedPorts(d->remoteStdout); const QList<Port> usedPorts = d->portsGatheringMethod->usedPorts(d->remoteStdout);
foreach (const Port port, usedPorts) { for (const Port port : usedPorts) {
if (d->device->freePorts().contains(port)) if (d->device->freePorts().contains(port))
d->usedPorts << port; d->usedPorts << port;
} }