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

Re: tostop && TTOU

On Dec 12, 11:22am, Danny Dulai wrote:
} Subject: tostop && TTOU
} I'm trying to get TTOU generated in a script, without forcing the user to
} stty tostop in the terminal controling shell.

You're going to have to give a few more details about the script.

In order to get a TTOU, the script itself must run in the background, or
it starts a background job; which one is it?

I played with this a bit, and if I run a script in the background which
attempts to do anything with stty, it gets TTOU even when the original
stty settings include -tostop.  I can only change the settings with a
foreground job.

} Can anyone give me an explaination of how tostop and TTOU interact with
} multiple layers of shells?

In shells with job control, which does not include scripts, zsh itself
ignores TTIN and TTOU; for other shells, it does not change the default
signal handling of TTIN or TTOU (which means they'll be ignored if the
parent process was ignoring them).

After forking (but, obviously, before exec'ing) an external process or
subshell, if job control is still active, zsh resets the TTIN and TTOU
handlers to the system default (which should be to stop the process).

But those aren't the only details involved.  Zsh also resets the tty
driver flags during various stages of ZLE processing, which can cause
changes made by other processes to be lost, and it changes (or doesn't)
the tty process group of subjobs in some cases, which may prevent them
from receiving tty signals (including TTIN/TTOU).

Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

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