forked from qt-creator/qt-creator
Utils: Consolidate port parsing methods
Change-Id: I137e9faa2c5f18e9ade0e2c59d73811d682abf13 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -37,7 +37,6 @@
|
||||
#include <utils/port.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/stringutils.h>
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
@@ -168,16 +167,7 @@ PortsGatheringMethod QnxDevice::portsGatheringMethod() const
|
||||
return {filePath("netstat"), {"-na"}};
|
||||
},
|
||||
|
||||
[](const QByteArray &output) {
|
||||
QList<Utils::Port> ports;
|
||||
const QList<QByteArray> lines = output.split('\n');
|
||||
for (const QByteArray &line : lines) {
|
||||
const Port port(Utils::parseUsedPortFromNetstatOutput(line));
|
||||
if (port.isValid() && !ports.contains(port))
|
||||
ports.append(port);
|
||||
}
|
||||
return ports;
|
||||
}
|
||||
&Port::parseFromNetstatOutput
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user