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.
This commit is contained in:
James Prestwood 2020-11-16 14:25:11 -08:00 committed by Denis Kenzior
parent f88d45c9d3
commit 3c708b0e14
1 changed files with 5 additions and 4 deletions

View File

@ -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]