fix: Windows compatibility - use shutil.which for ripgrep, add UTF-8 encoding#23
Open
RudyCity wants to merge 2 commits into
Open
fix: Windows compatibility - use shutil.which for ripgrep, add UTF-8 encoding#23RudyCity wants to merge 2 commits into
RudyCity wants to merge 2 commits into
Conversation
added 2 commits
June 21, 2026 15:22
…encoding
- grep.py: replace hardcoded '/usr/bin/rg' with shutil.which('rg')
- glob.py: replace bare 'rg' with shutil.which('rg')
- read.py: add encoding='utf-8' and errors='replace' to aiofiles.open()
- grep.py/glob.py: add encoding='utf-8' to subprocess.run() calls
Fixes [WinError 2] (rg binary not found) and 'charmap' codec errors
(non-ASCII file content) on Windows.
…shell detection Core (src/): - grep.py/glob.py: replace Path.as_posix() with str() for native Windows paths - grep.py/glob.py: add friendly error message when ripgrep is not installed - grep.py/glob.py: add FileNotFoundError safety net around subprocess.run - utils.py: detect Windows shell via COMSPEC instead of defaulting to bash Benchmark: - bench_fastcontext.py: add encoding='utf-8' to subprocess.run in _start_container - run_score.py: add encoding='utf-8' to open() - query_gen.py: add encoding='utf-8' to open() - bench_mini_swe_agent.py: add encoding='utf-8' to open(), read_text(), write_text()
Author
|
Pushed additional commits with more Windows compatibility fixes:
|
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
FastContext tools fail on Windows with two errors:
[WinError 2] The system cannot find the file specified_rg_path = "/usr/bin/rg"is hardcoded to a Linux path'charmap' codec can't decode byte 0x81aiofiles.open()has no encoding specified; Windows defaults tocp1252Fix
grep.py_rg_path = "/usr/bin/rg"withshutil.which("rg") or "rg"(cross-platform)encoding="utf-8", errors="replace"tosubprocess.run()glob.py"rg"withshutil.which("rg") or "rg"(explicit resolution)encoding="utf-8", errors="replace"tosubprocess.run()read.pyencoding="utf-8", errors="replace"toaiofiles.open()Testing
shutil.which("rg")resolves correctly on Windows/usr/bin/rgpath does not exist on Windows (root cause of WinError 2)charmapcrash occurs without encoding fix on non-ASCII contentencoding="utf-8", errors="replace"reads all content without crash