auto-t: Optionally start iwd from python lib

This commit is contained in:
Tim Kourt 2016-10-04 16:26:37 -07:00 committed by Denis Kenzior
parent 5d7f523bbf
commit d429d78940
1 changed files with 15 additions and 1 deletions

View File

@ -483,10 +483,24 @@ class IWD(AsyncOpAbstract):
_agent_manager_if = None
_known_network_manager_if = None
def __init__(self):
def __init__(self, start_iwd_daemon = False):
global mainloop
mainloop = GLib.MainLoop()
if not start_iwd_daemon:
return
import subprocess
iwd_proc = subprocess.Popen('iwd')
tries = 0
while not self._bus.name_has_owner(IWD_SERVICE):
if tries > 20:
iwd_proc.terminate()
raise TimeoutError('IWD has failed to start')
tries += 1
time.sleep(0.05)
@property
def _object_manager(self):
if self._object_manager_if is None: