Skip to content

Commit 5f2a1bc

Browse files
author
Zo Bot
committed
fix Windows short-circuit in man_pages.is_available
is_available guarded against Windows with `os.system == 'nt'`. os.system is the built-in function object from the os module, never a string, so the comparison was always False and the function never short-circuited on Windows even though that was clearly the author's intent (the surrounding code is checking whether the running OS has the `man` binary). On Windows the function fell through to `subprocess.run([MAN_COMMAND, ...])`, which is missing from PATH and raised FileNotFoundError that was then swallowed by the bare `except Exception`, so users saw a confusing 'no man pages found' instead of an immediate 'not on Windows' early return.
1 parent 5b604c3 commit 5f2a1bc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

httpie/output/ui/man_pages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def is_available(program: str) -> bool:
1818
Check whether `program`'s man pages are available on this system.
1919
2020
"""
21-
if NO_MAN_PAGES or os.system == 'nt':
21+
if NO_MAN_PAGES or os.name == 'nt':
2222
return False
2323
try:
2424
process = subprocess.run(

0 commit comments

Comments
 (0)