diff options
author | hjk <hjk@qt.io> | 2017-08-07 18:54:01 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2017-08-10 15:23:07 +0000 |
commit | 7f87e2af3c21343a0a7fd0a74b63b748584d60c6 (patch) | |
tree | 4baacf5f7a2c0c7f2ac372035805dab17da92241 /src/plugins/qnx/qnxdevice.cpp | |
parent | 4048629d1a5940032267f80e44c6032e881abd4e (diff) |
DeviceSupport: Implement DesktopDevice::portsGatheringMethod()
The feature is useful in a QtApplicationManager debugging context.
Internally, DeviceUsedPortsGatherer uses a DeviceProcess now,
not an SshRemoteProcess, to cover cases where the (Windows Desktop)
device not have ssh available.
Change-Id: I9d33ceac65a135123a376ebd2727dcb540563179
Reviewed-by: Wolfgang Bremer <wolfgang.bremer@pelagicore.com>
Reviewed-by: Dan Cape <dcape@qnx.com>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/qnx/qnxdevice.cpp')
-rw-r--r-- | src/plugins/qnx/qnxdevice.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/plugins/qnx/qnxdevice.cpp b/src/plugins/qnx/qnxdevice.cpp index 994f74a8392..31a8d9064d2 100644 --- a/src/plugins/qnx/qnxdevice.cpp +++ b/src/plugins/qnx/qnxdevice.cpp @@ -55,19 +55,25 @@ class QnxPortsGatheringMethod : public PortsGatheringMethod { // TODO: The command is probably needlessly complicated because the parsing method // used to be fixed. These two can now be matched to each other. - QByteArray commandLine(QAbstractSocket::NetworkLayerProtocol protocol) const + Runnable runnable(QAbstractSocket::NetworkLayerProtocol protocol) const override { Q_UNUSED(protocol); - return "netstat -na " + StandardRunnable runnable; + // FIXME: Is this extra shell needed? + runnable.executable = "/bin/sh"; + runnable.commandLineArguments = "-c \"" + "netstat -na " "| sed 's/[a-z]\\+\\s\\+[0-9]\\+\\s\\+[0-9]\\+\\s\\+\\(\\*\\|[0-9\\.]\\+\\)\\.\\([0-9]\\+\\).*/\\2/g' " "| while read line; do " "if [[ $line != udp* ]] && [[ $line != Active* ]]; then " "printf '%x\n' $line; " "fi; " - "done"; + "done" + "\""; + return runnable; } - QList<Port> usedPorts(const QByteArray &output) const + QList<Port> usedPorts(const QByteArray &output) const override { QList<Port> ports; QList<QByteArray> portStrings = output.split('\n'); |