Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: weird less(1) CTRL-Z behaviour



On Wed, 12 Oct 2022, Thomas Klausner wrote:

I've been using the following shell function for ages:

dir() { ls -al "$@" | less; }

On -current (9.99.100 kernel from Oct 9, Userland from Sep 21, zsh
from May), when I CTRL-Z the less(1) and then want to go back in, it
doesn't work and I see the following:

dir
zsh: done       ls -al "$@" |
zsh: suspended
fg
[1]  + done       ls -al "$@" |
      continued
zsh: done                    ls -al "$@" |
zsh: suspended (tty output)
zsh: done                    ls -al "$@" |
zsh: suspended (tty output)


Looks like a bug in zsh. /bin/sh is also the same. /bin/ksh
and bash work OK.

Since less sucks up its entire input, the ls command is "done"
and has exited in that pipeline (if you page forward a few screens).
The ls exiting in the pipeline seems to confuse zsh and /bin/sh.

If you run the function on a large dir. and suspend it at the 1st
screen, then /bin/sh also works because ls is still running and
can be suspended.

ksh also says "Done", but it still allows the pipeline to be fg'd
correctly:

[1] + Done                 ls -al "$@" |
      Stopped              less

File a PR.

-RVP



Home | Main Index | Thread Index | Old Index