Skip to content

Commit 97f23ed

Browse files
committed
Fixes #1898: Windows guard in is_available() compares os.system (a function) to 'nt' — always False
- Changed `os.system == 'nt'` to `sys.platform == 'win32'` - This fixes the Windows detection logic that was previously broken - The function now properly short-circuits on Windows systems
1 parent 5b604c3 commit 97f23ed

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

httpie/output/ui/man_pages.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
import subprocess
44
import os
5+
import sys
56
from httpie.context import Environment
67

78

89
MAN_COMMAND = 'man'
910
NO_MAN_PAGES = os.getenv('HTTPIE_NO_MAN_PAGES', False)
1011

12+
1113
# On some systems, HTTP(n) might exist, but we are only interested in HTTP(1).
1214
# For more information on man page sections: <https://unix.stackexchange.com/a/138643>
1315
MAN_PAGE_SECTION = '1'
@@ -18,7 +20,7 @@ def is_available(program: str) -> bool:
1820
Check whether `program`'s man pages are available on this system.
1921
2022
"""
21-
if NO_MAN_PAGES or os.system == 'nt':
23+
if NO_MAN_PAGES or sys.platform == 'win32':
2224
return False
2325
try:
2426
process = subprocess.run(
@@ -45,4 +47,4 @@ def display_for(env: Environment, program: str) -> None:
4547
[MAN_COMMAND, MAN_PAGE_SECTION, program],
4648
stdout=env.stdout,
4749
stderr=env.stderr
48-
)
50+
)

0 commit comments

Comments
 (0)