handle error when clangformat isn't installed

This commit is contained in:
Mylloon 2023-04-18 18:48:18 +02:00
parent 03cabb93eb
commit 49946be4e0
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -1,5 +1,6 @@
import re import re
import subprocess import subprocess
import sys
def clang_format(file_path): def clang_format(file_path):
@ -9,6 +10,9 @@ def clang_format(file_path):
command, stderr=subprocess.STDOUT, text=True) command, stderr=subprocess.STDOUT, text=True)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
output = e.output output = e.output
except FileNotFoundError as e:
print(f"Command not found: {e.filename}", file=sys.stderr)
exit(1)
return output return output