From 9c764c0e892ba66fc70df5e380d080b99c10e158 Mon Sep 17 00:00:00 2001 From: Vinay Kumar Date: Wed, 5 Aug 2026 19:57:04 +0530 Subject: [PATCH] =?UTF-8?q?Fix=20bug:=20Windows=20guard=20in=20is=5Favaila?= =?UTF-8?q?ble()=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 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. --- httpie/output/ui/man_pages.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/httpie/output/ui/man_pages.py b/httpie/output/ui/man_pages.py index 0ba4974578..350882a24e 100644 --- a/httpie/output/ui/man_pages.py +++ b/httpie/output/ui/man_pages.py @@ -2,6 +2,7 @@ import subprocess import os +import sys from httpie.context import Environment @@ -18,7 +19,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 +46,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