I found this note in the 'vim' release notes:
When using "cmd | vim -", stdin is not a terminal. This gave problems with
GPM (Linux console mouse) and when executing external commands. Now close
stdin and re-open it as a copy of stderr.
The source for version 6 does this:
if (read_stdin)
{
/* Use stderr for stdin, makes shell commands work. */
close(0);
dup(2);
}
I don't why this isn't a problem on Linux, too, but it is a problem on
Solaris 8. The native Sun version of 'vi' doesn't have this problem.
The quickest fix for this is to only redirect stdout to /dev/null
for the test
if echo 'r /nonexist-file
q' | ex > /dev/null 2>&1
Robert Elz noted that on NetBSD, the output was sent to stdout. The
Sun version of 'vi' and 'vim 6.0' do this as well.
Advice?