Skip to content

Commit

Permalink
libprologin: presenced: fix $ who parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
zopieux committed Aug 13, 2020
1 parent 4e49efb commit 8a863d1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions prologin/presenced/heartbeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ def get_logged_on_prologin_users() -> Set[str]:
"""Returns the set of logged-on users that are handled by Prologin."""
who = subprocess.check_output(['who', '-q'], encoding='utf-8')
# Output of `$ who -q` looks like:
# zopieux
# # users=1
# foo bar qux
# # users=3
return set(
username
for line in who.splitlines(keepends=False)
if (username := line.strip())
and not username.startswith('#')
and is_prologin_user(username)
for part in who.splitlines(keepends=False)[0].split()
if (username := part.strip()) and is_prologin_user(username)
)


Expand Down

0 comments on commit 8a863d1

Please sign in to comment.