Fix Windows path separators and console encoding#83
Open
dc995 wants to merge 1 commit into
Open
Conversation
build_context emitted component/file-cache paths using the OS-native separator (e.g. scripts\helper.py on Windows), which broke SARIF output and tests that expect POSIX-style paths. Normalize relative paths with Path.as_posix() so analysis output is identical across platforms. Apply the same �s_posix() normalization to the five test helpers that build file caches from fixture directories. The CLI terminal report also crashed on Windows consoles (cp1252) with UnicodeEncodeError when rendering box-drawing characters and icons. Reconfigure stdout/stderr to UTF-8 (errors="replace") at startup so the report renders without crashing on any platform. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Summary
Fixes three Windows-specific portability bugs discovered while running the test suite and CLI on Windows.
1. Path separators in �uild_context (product bug)
�uild_context emitted component and file-cache paths using the OS-native separator (e.g.
scripts\helper.pyon Windows) instead of forward slashes. This broke SARIF output and any consumer/test expecting POSIX-style paths. Fixed by normalizing relative paths withPath.as_posix().2. Console encoding crash in the CLI (product bug)
The terminal report crashed on Windows consoles (cp1252) with
UnicodeEncodeErrorwhen rendering box-drawing characters/icons. Fixed by reconfiguringstdout/stderrto UTF-8 (errors="replace") at CLI startup.3. Test helpers (test-only)
Five test helpers built fixture file-caches with
str(path), producing backslash keys on Windows. Normalized them with.as_posix()to match the product behavior.Validation
ruff check), format (ruff format --check), build (python -m build): all passNotes
Changes are surgical: path-separator normalization and stdout encoding only. No behavior change to analysis logic.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com