Starting with 8.2.1833, the :sh command no longer works when vim is
reading text from stdin. The screen flashes, but nothing else
happens.
To demonstrate this, execute the following:
$ ls | vim -N -u NONE -
:sh
Using git bisect, I found the offending commit.
$ git bisect bad
204ade6bcb85f48f56e52e040d1ebf40548d92be is the first bad commit
commit 204ade6bcb85f48f56e52e040d1ebf40548d92be
Author: Bram Moolenaar <
Br...@vim.org>
Date: Sun Oct 11 14:58:46 2020 +0200
patch 8.2.1833: when reading from stdin dup() is called twice
Problem: When reading from stdin dup() is called twice.
Solution: Remove the dup() in main.c. (Ken Takata, closes #7110)
src/main.c | 15 +++++----------
src/version.c | 2 ++
2 files changed, 7 insertions(+), 10 deletions(-)
The operating system I'm using is Ubuntu 20.04.1 LTS.
More information:
If before executing :sh, you set the 'shell' to /bin/cat, then
executing :sh will cause cat to report the following error.
/bin/cat: -: Bad file descriptor
/bin/cat: closing standard input: Bad file descriptor
This problem also occurs when one of vim's arguments is a bash
process substitution. That's been a problem for a while.
My workaround is to detect the problematic conditions and then set
'shell' to a script containing the following.
#!/bin/bash
exec < /dev/tty
exec $SHELL "$@"
Regards,
Gary