Skip to content

Fix bug: Windows guard in is_available() compares os.system (a function) to 'nt' — always False - #1917

Draft
vinayK34 wants to merge 1 commit into
httpie:masterfrom
vinayK34:fix/issue-1898
Draft

Fix bug: Windows guard in is_available() compares os.system (a function) to 'nt' — always False#1917
vinayK34 wants to merge 1 commit into
httpie:masterfrom
vinayK34:fix/issue-1898

Conversation

@vinayK34

@vinayK34 vinayK34 commented Aug 5, 2026

Copy link
Copy Markdown

Description

This PR fixes a bug in httpie/output/ui/man_pages.py where the Windows platform check was incorrect. The comparison os.system == 'nt' was comparing a built-in function to a string, which is always False. This meant that the Windows guard never triggered, causing man pages to be attempted to be displayed on Windows systems despite the intention to skip them.

Changes

  • Changed os.system == 'nt' to sys.platform == 'win32' for proper Windows platform detection
  • Added import sys to support the platform check
  • This is the most robust way to detect Windows platforms according to Python documentation

Impact

This fix ensures that man pages are properly skipped on Windows systems, preventing unnecessary errors and improving the user experience on Windows platforms where man commands are typically not available.

…on) to 'nt' — always False

The comparison `os.system == 'nt'` was incorrect because `os.system` is a built-in function,
not a string. This caused the Windows guard to never trigger, meaning man pages would
be attempted to be displayed on Windows systems despite the intention to skip them.

Changed to `sys.platform == 'win32'` which is the most robust way to detect Windows platforms.
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.

1 participant