-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
Since v8.2.1513, running a shell from vim (with :sh) leads to the parent shell (the one used to run vim in a terminal) to quit unexpectedly. This behavior is onbserved on OpenBSD-current with either bash or ksh.
This is due to the following chain of functions in os_unix.c:
mch_call_shell_fork calling (after fork, in the parent) mch_delay, calling mch_settmode (indirectly via settmode in term.c) which calls tcsetattr. But at this point the shell spawned with :sh has already called tcsetpgrp, so vim is in the background and tcsetattr triggers a SIGTTOU signal, which stops (i.e. suspends) vim. This triggers a reaction from the parent shell, etc.
In the case of a shell called from vim with :sh, vim should not touch the terminal after fork until the child shell exits.