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

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 01 Nov 2024 18:36:02 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=282414

Wolfram Schneider <wosch@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|New                         |Open

--- Comment #1 from Wolfram Schneider <wosch@FreeBSD.org> ---
Looking at debian12 I see $PAGER will not be called by man(1) if stdout is not
a tty:

PAGER='vim -' man man | wc 
    626    4724   35027

# non-existing pager program
PAGER='vim222 -' man man | wc 
    626    4724   35027

On FreeBSD 15-current:

PAGER='vim -' man man | wc   
Vim: Warning: Output is not to a terminal

PAGER='vim22 -' man man | wc   
eval: vim22: not found
       0       0       0

We could re-set $MANPAGER in the function setup_pager() to /bin/cat if test -t
1 returns false: 

  # stdout is not a TTY, skip PAGER
  if [ ! -t 1 ]; then
    MANPAGER="cat"
  fi

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