commit 3c708b0e14666a2459fb948cee2a73f71da3e190
parent f88d45c9d3773d17421b3844d50b5939f89c1e10
Author: James Prestwood <prestwoj@gmail.com>
Date: Mon, 16 Nov 2020 14:25:11 -0800
auto-t: update hostapd.list_sta to use Process.out
Instead of list_sta() waiting for the PID itself it can
just use wait=True and grab the output out of the Process
class itself.
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/autotests/util/hostapd.py b/autotests/util/hostapd.py
@@ -152,11 +152,12 @@ class HostapdCLI:
ctx.start_process(self.cmdline + ['enable'], wait=True)
def list_sta(self):
- proc = ctx.start_process(self.cmdline + ['list_sta'])
- proc.pid.wait()
- lines = proc.pid.stdout.read().decode('utf-8')
+ proc = ctx.start_process(self.cmdline + ['list_sta'], wait=True)
- return [line for line in lines.split('\n') if line]
+ if not proc.out:
+ return []
+
+ return [line for line in proc.out.split('\n') if line]
def set_neighbor(self, addr, ssid, nr):
cmd = self.cmdline + ['set_neighbor', addr, 'ssid="%s"' % ssid, 'nr=%s' % nr]