Skip to content

Avoid Colorama initialization in Git Bash on Windows - #731

Open
MateehUllah wants to merge 2 commits into
google:masterfrom
MateehUllah:fix/git-bash-colorama-init-575
Open

MateehUllah wants to merge 2 commits into
google:masterfrom
MateehUllah:fix/git-bash-colorama-init-575

Conversation

@MateehUllah

Copy link
Copy Markdown

Summary

Fixes #575

This PR prevents unnecessary Colorama initialization when Python Fire runs inside Git Bash on Windows.

Git Bash already supports ANSI escape sequences, so initializing Colorama can cause redundant output wrapping and interfere with terminal colors.

Changes

  • Detect Git Bash environments using the MSYSTEM environment variable.
  • Skip Colorama initialization for MinGW and MSYS terminals.
  • Preserve existing behavior for other Windows terminals.
  • Add unit tests covering Git Bash detection, standard Windows initialization, and behavior when Colorama is unavailable.

Testing

Added focused unit tests for the affected behavior.

The full test suite has not yet been run locally. CI validation is requested.

Files Changed

  • fire/formatting_windows.py
  • fire/formatting_windows_test.py

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't show ansi color on windows if use git bash

1 participant