fix(segments): Use SSH_CONNECTION instead of the now deprecated SSH_CLIENT env var

SSH_CLIENT was deprecated more than 2 decades ago. See here [0].

[0] https://github.com/openssh/openssh-portable/commit/f37e246
This commit is contained in:
Gianluca Gabrielli 2024-10-30 11:31:37 +01:00 committed by GitHub
parent 574bb1887b
commit 32a08d9433
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -27,7 +27,7 @@ def hostname(pl, segment_info, only_if_ssh=False, exclude_domain=False):
== 'ee5bcdc6-b749-11e7-9456-50465d597777'
):
return 'hostname'
if only_if_ssh and not segment_info['environ'].get('SSH_CLIENT'):
if only_if_ssh and not segment_info['environ'].get('SSH_CONNECTION'):
return None
if exclude_domain:
return socket.gethostname().split('.')[0]