os: Check for programs/files instead of ignoring errors

This commit is contained in:
Benjamin Kästner 2021-05-01 17:48:15 +02:00
parent 9ccd234a3d
commit c432776b95
1 changed files with 5 additions and 4 deletions

View File

@ -317,10 +317,11 @@ If RELEASE-FILE is nil, use '/etc/os-release'."
(defun eshell-info-banner--get-os-information ()
"Get operating system identifying information."
(or (ignore-errors (eshell-info-banner--get-os-information-from-hostnamectl))
(ignore-errors (eshell-info-banner--get-os-information-from-lsb-release))
(ignore-errors (eshell-info-banner--get-os-information-from-release))
"Unkown"))
(cond
((executable-find "hostnamectl") (eshell-info-banner--get-os-information-from-hostnamectl))
((executable-find "lsb_release") (eshell-info-banner--get-os-information-from-lsb-release))
((file-exists-p "/etc/os-release") (eshell-info-banner--get-os-information-from-release-file))
(t "Unknown")))
; Public functions ;;;;;;;;;;;;;;;;;;;;