From 3c708b0e14666a2459fb948cee2a73f71da3e190 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Mon, 16 Nov 2020 14:25:11 -0800 Subject: [PATCH] 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. --- autotests/util/hostapd.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/autotests/util/hostapd.py b/autotests/util/hostapd.py index cf82c010..3f48bd57 100644 --- 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]