On Tuesday, January 10, 2023 10:28:42 PM CET Jilles Tjoelker wrote: Hello Jilles, > The loop with SIGTTIN is the right thing for an interactive job control > shell. It ensures that two job control shells do not interfere. The idea > is that the user can later 'fg' from the outer job control shell. > > The loop also helps with suspending a job control shell, for example via > the funcs/suspend function from the ash source (containing 'local -', > 'set +m' and 'kill -TSTP 0'): when trying to resume the inner shell via > 'bg' in the outer shell, it is this loop that makes the inner shell stop > itself. Thanks for those explanations. > However, for a non-interactive shell, monitor mode is most useful for > its effect of placing jobs in their own process groups. This does not > necessarily imply any tty manipulation. > > To make this possible, feature was added to FreeBSD sh in > https://cgit.freebsd.org/src/commit/?id=cd60e2c67d52e1f957841af19128c7227880 > 743a > > This commit allows using job control without a tty in non-interactive > mode. > [...] This is exactly what I use fpsync for (to get a new process group). Do I understand that this feature is not available in Dash ? > Manipulating the disposition of TTIN/TTOU/TSTP with job control enabled > might be a question of "if it hurts, don't do that". Thanks! -- Ganael LAPLANCHE <ganael.laplanche@xxxxxxxxxxxx> http://www.martymac.org | http://contribs.martymac.org FreeBSD: martymac <martymac@xxxxxxxxxxx>, http://www.FreeBSD.org