From 1b045b1e60c2c10178828b20036a3590784bbbfc Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Mon, 9 Jan 2023 08:21:21 +0000 Subject: [PATCH] Handle doctor permission issues while checking udev (#19548) --- lib/python/qmk/cli/doctor/linux.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/python/qmk/cli/doctor/linux.py b/lib/python/qmk/cli/doctor/linux.py index a803305c0da..95bafe8c641 100644 --- a/lib/python/qmk/cli/doctor/linux.py +++ b/lib/python/qmk/cli/doctor/linux.py @@ -78,10 +78,13 @@ def check_udev_rules(): # Collect all rules from the config files for rule_file in udev_rules: - for line in rule_file.read_text(encoding='utf-8').split('\n'): - line = line.strip() - if not line.startswith("#") and len(line): - current_rules.add(line) + try: + for line in rule_file.read_text(encoding='utf-8').split('\n'): + line = line.strip() + if not line.startswith("#") and len(line): + current_rules.add(line) + except PermissionError: + cli.log.debug("Failed to read: %s", rule_file) # Check if the desired rules are among the currently present rules for bootloader, rules in desired_rules.items():