mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 03:34:15 +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:
|
||||
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 ' running ' in o.decode():
|
||||
return True
|
||||
line = o.decode().strip()
|
||||
return bool(line)
|
||||
|
||||
return False
|
||||
|
||||
@@ -178,4 +178,3 @@ def run(app: SnapApplication, logger: logging.Logger):
|
||||
logger.error("No valid command found for '{}'".format(app_name))
|
||||
else:
|
||||
logger.error("No command found for '{}'".format(app_name))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user