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

Re: Terminal initialization and (non-)interactive shells



Bart Schaefer wrote:

> } Bart Schaefer wrote:
> } 
> } > (For Drazen) Is it desirable to ALWAYS do this?  For a backgrounded shell,
> } > calling ioctl() on a tty device will usually result in a SIGTTOU stopping
> } > the process.

> Every zsh, foreground or background, calls init_io(), which in turn does all
> the tty initialization if isatty(0).  There's no test for `interactive'.
> 
> This is, arguably, wrong.

I did some checking on Solaris 7. TIOCNXCL is handled by ttcompat streams
module, which provides 4BSD streams compatibility (struct sgttyb things).

An ioctl(TIOCNXCL) call from background process succeeds in unlocking
the terminal device. Man page doesn't say a thing about this, but I think
it's safe to put it anywhere. I don't know about non-Solaris systems.

Besides, isatty(0) for background shell [checked with (echo foo >/dev/tty)& ]
doesn't return 1.

-- 
 .-.   .-.    Life is a sexually transmitted disease.
(_  \ /  _)
     |        dave@xxxxxxx
     |        dave@xxxxxxxxxxxxx




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