Skip to content

Commit

Permalink
Fix ruff discovery for paths containing symbols that can't be represe…
Browse files Browse the repository at this point in the history
…nted by the local encoding
  • Loading branch information
MichaReiser committed Aug 15, 2024
1 parent d84e14b commit 4f1d558
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bundled/tool/find_ruff_binary_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
from pathlib import Path
from typing import Optional

# Python defaults to the system local encoding by default on Windows.
# This creates problems with unicode paths that aren't covered by the local encoding.
# The node process calling this script defaults to UTF8, so let's do the same here.
sys.stdout.reconfigure(encoding="utf-8")

RUFF_EXE = "ruff.exe" if sys.platform == "win32" else "ruff"


Expand Down Expand Up @@ -32,4 +37,4 @@ def find_ruff_binary_path() -> Optional[Path]:
if __name__ == "__main__":
ruff_binary_path = find_ruff_binary_path()
if ruff_binary_path:
print(os.fsdecode(str(ruff_binary_path)), flush=True)
print(os.fsdecode(ruff_binary_path), flush=True)

0 comments on commit 4f1d558

Please sign in to comment.