fix: add fallback to lastlog2 for SSH login retrieval and remove unnecessary libptytty dependency
Some checks failed
Nix Format Check / check-format (push) Failing after 38s
Some checks failed
Nix Format Check / check-format (push) Failing after 38s
This commit is contained in:
@ -14,6 +14,12 @@ def get_last_ssh_login():
|
||||
try:
|
||||
result = subprocess.run(['lastlog', '-u', os.environ.get("USER", "")],
|
||||
capture_output=True, text=True)
|
||||
|
||||
# If lastlog didn't work try lastlog2
|
||||
if result.returncode != 0:
|
||||
result = subprocess.run(['lastlog2', os.environ.get("USER", "")],
|
||||
capture_output=True, text=True)
|
||||
|
||||
if result.returncode == 0:
|
||||
lines = result.stdout.strip().split('\n')
|
||||
if len(lines) >= 2: # Header line + data line
|
||||
|
Reference in New Issue
Block a user