diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-01-25 02:29:31 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-01-25 02:29:31 +0300 |
commit | c1720c98a468c5856c29d06c2260d896b53aa160 (patch) | |
tree | 99b6e882006c15e1b34ee27e77d615020f2e41c9 | |
parent | test/test.sh: print curl output on failure (diff) | |
download | linux-status-c1720c98a468c5856c29d06c2260d896b53aa160.tar.gz linux-status-c1720c98a468c5856c29d06c2260d896b53aa160.zip |
app.py: don't query user info if no users
-rwxr-xr-x | app.py | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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 |