mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-10 00:44:16 +02:00
improving snap / snapd installation check latency
This commit is contained in:
@@ -17,10 +17,10 @@ def is_installed():
|
|||||||
def is_snapd_running() -> bool:
|
def is_snapd_running() -> bool:
|
||||||
services = new_subprocess(['systemctl', 'list-units'])
|
services = new_subprocess(['systemctl', 'list-units'])
|
||||||
|
|
||||||
for o in new_subprocess(['grep', 'snapd.socket'], stdin=services.stdout).stdout:
|
for o in new_subprocess(['grep', '-oP', 'snapd.socket.+\K(listening|running)'], stdin=services.stdout).stdout:
|
||||||
if o:
|
if o:
|
||||||
if ' running ' in o.decode():
|
line = o.decode().strip()
|
||||||
return True
|
return bool(line)
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -178,4 +178,3 @@ def run(app: SnapApplication, logger: logging.Logger):
|
|||||||
logger.error("No valid command found for '{}'".format(app_name))
|
logger.error("No valid command found for '{}'".format(app_name))
|
||||||
else:
|
else:
|
||||||
logger.error("No command found for '{}'".format(app_name))
|
logger.error("No command found for '{}'".format(app_name))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user