diff --git a/bench/patches/v5/fix_user_permissions.py b/bench/patches/v5/fix_user_permissions.py index 13bac4cbe..346c78b7e 100644 --- a/bench/patches/v5/fix_user_permissions.py +++ b/bench/patches/v5/fix_user_permissions.py @@ -12,7 +12,7 @@ def is_sudoers_set(): cmd = ["sudo", "-n", "bench"] - return (not subprocess.call(cmd)) or (change_uid_msg in get_cmd_output(cmd)) + return (not subprocess.call(cmd)) or (change_uid_msg in get_cmd_output(cmd, _raise=False)) def is_production_set(bench_path): diff --git a/bench/utils.py b/bench/utils.py index bfc4cda00..7b1a47424 100755 --- a/bench/utils.py +++ b/bench/utils.py @@ -510,13 +510,13 @@ def check_git_for_shallow_clone(): return True -def get_cmd_output(cmd, cwd='.'): +def get_cmd_output(cmd, cwd='.', _raise=True): try: output = subprocess.check_output(cmd, cwd=cwd, shell=True, stderr=subprocess.PIPE).strip() except subprocess.CalledProcessError as e: if e.output: output = e.output - else: + elif _raise: raise return safe_decode(output)