On Mon, May 31, 2021 at 12:23 PM Bram Moolenaar <[email protected]> wrote: > Felipe Contreras wrote: > > > Processes are not being started correctly with TIOCSCTTY, which does > > succeed after setsid(). > > > > None of that stuff is necessary, including the silencing of SIGHUP. > > > > It's not even executed when shellpipe is off. > > I suspect removing setsid() will cause trouble if a terminal with a > shell is started and that shell exits.
No, I tested that. Moreover, this is only done with the GUI *and* `shellpipe` is disabled. If there was a problem with terminating shells, shouldn't we already see the problem on console, or when `shellpipe` is off? The whole point of setsid() is to create a new session. That should not be done by vim. If that's what the user wants, he can do :!setsid $foo. > There is a reason this code was > added. It was done long ago, I don't recall how to reproduce the > problem. Unfortunately there is no history for that code, it's there in the first tag (7.0001). grepping the code there are some mention of issues with child processes before they do setsid() themselves. Maybe some tests could be done adding a delay before executing the child and hitting (Ctrl-C), or perhaps with a fake shell that never does setsid(). > Just removing the TIOCSCTTY seems to already fix the problem. So how > about just deleting these lines: > > > > > -# ifdef TIOCSCTTY > > - // Try to become controlling tty (probably doesn't work, > > - // unless run by root) > > - ioctl(pty_slave_fd, TIOCSCTTY, (char *)NULL); > > -# endif Yeah, that should do it. But I don't see the need to create a new session on every fork. > I wonder what the simplest way is to test the fix. I did provide examples with posix_spawn and g_spawn_async that both reproduce the issue. Cheers. -- Felipe Contreras -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAMP44s1gq3sEFKGK72ezyVXPkxMo9qioYexy5FjjDt19rk4w4A%40mail.gmail.com.
