From 49946be4e0ce51ce12985dcea5a7edf211c8825d Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 18 Apr 2023 18:48:18 +0200 Subject: [PATCH] handle error when clangformat isn't installed --- main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.py b/main.py index 98e4fe3..f47566b 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,6 @@ import re import subprocess +import sys def clang_format(file_path): @@ -9,6 +10,9 @@ def clang_format(file_path): command, stderr=subprocess.STDOUT, text=True) except subprocess.CalledProcessError as e: output = e.output + except FileNotFoundError as e: + print(f"Command not found: {e.filename}", file=sys.stderr) + exit(1) return output