Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Weird bug / missing feature with gvim interaction


I've been investigating for a while a weird interaction with vim and
zsh, and this is the closest I've gotten to narrowing down the

Essentially this doesn't work:

    vim -g -c 'set shelltemp' -c ':!xdg-open "https://google.com";'

The reason it doesn't work is that xdg-open immediately spawns a fork,
which is why this doesn't work either:

    vim -g -c 'set shelltemp' -c ':!touch /tmp/fork-cur &'

But that actually works in bash.

The two key lines of code from vim are:

    ioctl(slave, TIOCSCTTY, NULL);

If I remove those, the code works fine, but then it doesn't work with sudo:

    vim -g -c 'set shelltemp' -c ':!sudo touch /tmp/sudo &'

But it does with bash.

It is a bit overwhelming, since there are many combinations:


But long story short, there's a combination that works with bash, but
there isn't a single one that works with zsh.

I wrote a program to be able to test this behavior outside of vim, and
I can reproduce the problem [1].

The two combinations that don't work with zsh are:

1. sudo without setsid (the program cannot feed input into sudo)
2. fork with setsid (the grandchilds are sent SIGHUP)

This is beyond my expertise, but I've tried my best to narrow down the problem.

Is there any way to solve this in zsh?


[1] https://gist.githubusercontent.com/felipec/8a820f3dbf67a5861491553e211400fb/raw/e7f537c0b5b5f4d742f90cfac5f7f046ea61d438/pty-test.c

Felipe Contreras

Messages sorted by: Reverse Date, Date, Thread, Author