Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Add error handling for when dotnet not found

mb-bts74bfe155af94
diff --git a/misc/scripts/dotnet_format.py b/misc/scripts/dotnet_format.py
index 859bfa9f093..2137b98e3e6 100755
--- a/misc/scripts/dotnet_format.py
+++ b/misc/scripts/dotnet_format.py
@@ -31,4 +31,11 @@ projects = {
# Run dotnet format on all projects with more than 0 modified files.
for path, files in projects.items():
if files:
- subprocess.run(["dotnet", "format", path, "--include", files])
+ try:
+ subprocess.run(["dotnet", "format", path, "--include", files])
+ except FileNotFoundError:
+ print(
+ "Couldn't find \"dotnet\" executable. Install the .NET SDK and ensure it's in your PATH. "
+ "Alternatively, if using prek, pass `--skip dotnet-format` to skip this hook."
+ )
+ sys.exit(1)