From 7ba34ce363598040b77ad40c0b375dc71ea07636 Mon Sep 17 00:00:00 2001 From: Vinay Kumar Date: Mon, 10 Aug 2026 17:48:29 +0530 Subject: [PATCH] =?UTF-8?q?Fix:=20Windows=20guard=20in=20is=5Favailable()?= =?UTF-8?q?=20compares=20os.system=20(a=20function)=20to=20'nt'=20?= =?UTF-8?q?=E2=80=94=20always=20False?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixed the bug where `os.system == 'nt'` was always False because os.system is a function - Changed to use `sys.platform == 'win32'` which is the correct way to detect Windows platforms - Added missing import for sys module - This ensures man pages are properly disabled on Windows systems --- httpie/output/ui/man_pages.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/httpie/output/ui/man_pages.py b/httpie/output/ui/man_pages.py index 0ba4974578..4b320ef34a 100644 --- a/httpie/output/ui/man_pages.py +++ b/httpie/output/ui/man_pages.py @@ -2,12 +2,14 @@ import subprocess import os +import sys from httpie.context import Environment MAN_COMMAND = 'man' NO_MAN_PAGES = os.getenv('HTTPIE_NO_MAN_PAGES', False) + # On some systems, HTTP(n) might exist, but we are only interested in HTTP(1). # For more information on man page sections: MAN_PAGE_SECTION = '1' @@ -18,7 +20,7 @@ def is_available(program: str) -> bool: Check whether `program`'s man pages are available on this system. """ - if NO_MAN_PAGES or os.system == 'nt': + if NO_MAN_PAGES or sys.platform == 'win32': return False try: process = subprocess.run( @@ -45,4 +47,4 @@ def display_for(env: Environment, program: str) -> None: [MAN_COMMAND, MAN_PAGE_SECTION, program], stdout=env.stdout, stderr=env.stderr - ) + ) \ No newline at end of file