handle error when clangformat isn't installed
This commit is contained in:
parent
03cabb93eb
commit
49946be4e0
1 changed files with 4 additions and 0 deletions
4
main.py
4
main.py
|
@ -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
|
||||||
|
|
||||||
|
|
Reference in a new issue