[Bug 282414] man calls pager even when stdout is not a TTY

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 30 Oct 2024 04:30:50 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=282414

            Bug ID: 282414
           Summary: man calls pager even when stdout is not a TTY
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: aclopte@gmail.com

Vim or Neovim can act as man pagers

    PAGER='vim -' man man
    PAGER='nvim +Man!' man man

however it breaks when stdout is not a TTY (e.g. when adding "| cat" to above
command). This breakage surfaces in applications such as shells and editors
that want to display the output of "man" (or "apropos" which uses the same
script) somewhere that's not the entire terminal.

This could be fixed by either:
1. having Neovim behave like cat when stdout is not a TTY
2. or making man not call $PAGER in this case (or I guess use "cat" to simplify
implementation)

I think option 2 makes sense because the pager is unnecessary here. Also man
already behaves differently if stdout is not a TTY (it doesn't add ANSI escape
codes for bold fonts etc). This is also what
[man-db](https://gitlab.com/man-db/man-db) does.

Probably needs to be changed in
https://cgit.freebsd.org/src/tree/usr.bin/man/man.sh

Originally reported as https://github.com/fish-shell/fish-shell/issues/10820

-- 
You are receiving this mail because:
You are the assignee for the bug.