fix: Handle platform info retrieval errors gracefully

This commit is contained in:
Paul Gauthier (aider) 2025-03-21 11:21:53 -07:00
parent e245d39216
commit cf496abec0

View file

@ -1030,7 +1030,13 @@ class Coder:
return None
def get_platform_info(self):
platform_text = f"- Platform: {platform.platform()}\n"
platform_text = ""
try:
platform_text = f"- Platform: {platform.platform()}\n"
except Exception:
# Skip platform info if it can't be retrieved
pass
shell_var = "COMSPEC" if os.name == "nt" else "SHELL"
shell_val = os.getenv(shell_var)
platform_text += f"- Shell: {shell_var}={shell_val}\n"