From 09a34b19eddda5f1a92f1855b1f25f036300d9a1 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 17 Jan 2025 14:56:47 +0100 Subject: [PATCH] Fix sudo 2 (#18738) Signed-off-by: Glenn Jocher Co-authored-by: UltralyticsAssistant --- ultralytics/utils/checks.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ultralytics/utils/checks.py b/ultralytics/utils/checks.py index bba75298..984b7e46 100644 --- a/ultralytics/utils/checks.py +++ b/ultralytics/utils/checks.py @@ -787,11 +787,12 @@ def is_sudo_available() -> bool: Check if the sudo command is available in the environment. Returns: - bool: True if the sudo command is available, False otherwise. + (bool): True if the sudo command is available, False otherwise. """ if WINDOWS: return False - subprocess.run("sudo --version", shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode == 0 + cmd = "sudo --version" + return subprocess.run(cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode == 0 # Run checks and define constants