wofr06 / lesspipe

lesspipe - display more with less
GNU General Public License v2.0
484 stars 51 forks source link

Warning "ps: stdin: not a terminal" with each execution of lesspipe. #128

Closed yrammos closed 1 year ago

yrammos commented 1 year ago

Piping anything through lesspipe produces output such as the following:

> cat ~/.zshrc | lesspipe.sh
ps: stdin: not a terminal
LESSOPEN="|/opt/homebrew/bin/lesspipe.sh %s"
export LESSOPEN

I'm reproducing this both with the macOS terminal and kitty.app.

For testing purposes, I produced a minimal .zshrc containing only the following:

export PAGER='less'
export READNULLCMD='bat'
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export LESS='-giR'
export LESSOPEN="|/opt/homebrew/bin/lesspipe.sh %s"
export LESSCOLORIZER='bat --style=plain'

Would be thankful for any suggestions.

yrammos commented 1 year ago

Running zsh 5.9, by the way.

wofr06 commented 1 year ago

I just committed a change that does suppress the error message from the ps command in MacOS. Apart from that you certainly wanted to achieve something else. To get the output from a pipe filtered throgh lesspipe.sh you need to set the variable LESSOPEN properly and pipe into less, not lesspipe.sh as follows:

export LESSOPEN="|-/opt/homebrew/bin/lesspipe.sh %s" cat ~/.zshrc | less

Please consult the man page of less for the use of |- and ||- in LESSOPEN

yrammos commented 1 year ago

Thanks for the fix and the correction, @wofr06.