1447Re: Mac-VIM doesn't cooperate with Finder
- Feb 7, 2004
> Aha. I suppose you could see the messages on /dev/console by openingMac OS X comes with a utility called Console, which is some kind of log
> it. (never had the idea to look there though).
viewer. And every output to /dev/console goes into
/Library/Logs/.../$LOGNAME/console.log (similar to .xsession-errors). I
had Console running at some point and caught the output of Vim messages
kind of by incidence :)
> That looks like a good solution. To stay on the safe side I think weYes, checking isatty() also is important. I forgot about that. Someone
> should also use isatty(). And add a comment about why it's done this
> way (in two years we will have forgotten all about it).
might redirect stderr to /dev/null or something, which must be tested
> Here is the patch with my additions, please check it out:Works fine for me. I tried a terminal Vim, GUI Vim started from
Terminal, and GUI vim started from Finder (and by "open -a Vim"). The
error dialog pops up only when there is no terminal to show the output.
I thought about the redirection and additional isatty() check some
more. I actually use a DropOutScript (wrapper around a shell script) to
open every file with the extension .vimsession by calling Vim with some
arguments. I redirect input and output as well as stderr to /dev/null.
Since this isn't a tty, ttyname returns NULL (I assume) and the strcmp
causes a SIGBUS. The line in main() therefor should read:
if (gui.starting && (!isatty(2) || strcmp("/dev/console", ttyname(2))
After this little change, starting the GUI with redirected output works
again (and reports errors via a popup dialog.)
- << Previous post in topic Next post in topic >>