man(1) always piped its output through $MANPAGER, even when stdout
was not a terminal. With the default pager (less) this is harmless,
because less behaves like cat when it is not writing to a terminal.
However, if MANPAGER is set to an interactive program such as
"nvim +Man!", programs that capture man's output through a pipe, for
example the man page preview in Emacs, hang waiting for the pager to
finish.
Use cat instead of the configured pager when stdout is not a terminal.
An explicit -P option is still available, so users who want a pager or
filter in a pipeline can request one.
PR: 282414
Reported by: Johannes Altmanninger <aclopte@gmail.com>
Signed-off-by: Kushagra Chauhan <zenzesama@gmail.com>