From c1720c98a468c5856c29d06c2260d896b53aa160 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 25 Jan 2022 02:29:31 +0300 Subject: app.py: don't query user info if no users --- app.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 1ed34a0..67cdd6d 100755 --- a/app.py +++ b/app.py @@ -411,9 +411,11 @@ def systemd_users(): yield User(uid, user) def show_users(users): + user_args = [user.name for user in users] + if not user_args: + return None properties = 'UID', 'Name', 'RuntimePath' prop_args = (arg for prop in properties for arg in ('-p', prop)) - user_args = (user.name for user in users) output = Loginctl('show-user', *prop_args, '--value', *user_args).run().result() lines = output.splitlines() # Assuming that for muptiple users, the properties will be separated by -- cgit v1.2.3