From 5ffa1868e30b2d87ab6e8ae2e6b4069626d5ad72 Mon Sep 17 00:00:00 2001 From: keyboard-slayer Date: Fri, 23 Feb 2024 18:45:42 +0100 Subject: [PATCH] fix(shell): check if system is Linux before check for os_release Why this change ? ================= On Windows or MacOS, Cutekit will crash because it cannot access Linux distro informations available inside of the /etc directory The fix ======= A simple check if the system is Linux should do the job. --- cutekit/shell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cutekit/shell.py b/cutekit/shell.py index 456ce23..d74675a 100644 --- a/cutekit/shell.py +++ b/cutekit/shell.py @@ -32,7 +32,7 @@ class Uname: def uname() -> Uname: un = platform.uname() - if hasattr(platform, "freedesktop_os_release"): + if un.system == "Linux" and hasattr(platform, "freedesktop_os_release"): distrib = platform.freedesktop_os_release() else: distrib = {"NAME": "Unknown"}