From 69746761ff55466c0aa1092f32a69cee6cc9b65f Mon Sep 17 00:00:00 2001 From: Olivier Cervello Date: Sun, 15 Sep 2024 15:16:33 +0200 Subject: [PATCH] Update command.py --- secator/runners/command.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/secator/runners/command.py b/secator/runners/command.py index 9a21572b..285c560d 100644 --- a/secator/runners/command.py +++ b/secator/runners/command.py @@ -477,8 +477,12 @@ def _prompt_sudo(self, command): return None # Check if sudo can be executed without a password - if subprocess.run(['sudo', '-n', 'true'], capture_output=False).returncode == 0: - return None + try: + if subprocess.run(['sudo', '-n', 'true'], capture_output=False).returncode == 0: + return None + except ValueError: + error = "Could not run sudo check test" + self.errors.append(error) # Check if we have a tty if not os.isatty(sys.stdin.fileno()):