Skip to content

fix: correct Windows guard in is_available() - #1911

Open
cyforkk wants to merge 1 commit into
httpie:masterfrom
cyforkk:cyforkk/fix-windows-man-pages-guard
Open

fix: correct Windows guard in is_available()#1911
cyforkk wants to merge 1 commit into
httpie:masterfrom
cyforkk:cyforkk/fix-windows-man-pages-guard

Conversation

@cyforkk

@cyforkk cyforkk commented Jul 29, 2026

Copy link
Copy Markdown

Description

The previous check os.system == 'nt' compared a built-in function object to a string, which is always False. The Windows short-circuit never fired, causing the function to rely on a swallowed exception for control flow on Windows.

This fix uses sys.platform == 'win32' for a robust Windows check.

Changes

  • Fix is_available() in httpie/output/ui/man_pages.py to use sys.platform == 'win32'
  • Add import sys
  • Add tests in tests/test_man_pages.py covering:
    • Windows platform returns False
    • HTTPIE_NO_MAN_PAGES env var returns False
    • man command exists returns True
    • man command fails returns False
    • subprocess exception returns False

Fixes #1898

The previous check  compared a built-in function
object to a string, which is always False. The Windows short-circuit
never fired, causing the function to rely on a swallowed exception
for control flow on Windows.

This fix uses  for a robust Windows check.

Fixes httpie#1898
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.

Bug: Windows guard in is_available() compares os.system (a function) to 'nt' — always False

1 participant