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

Re: zsh stty control for background processes

On Jan 31,  2:54pm, Yoshiaki Kasahara wrote:
} Subject: zsh stty control for background processes
} When I invoked 'xterm &', new shell in the xterm forget some of stty
} control characters.

This isn't exactly a shell bug; it's partly an xterm bug.  It results
when xterm copies stty information from the system console, which may
not have been set up correctly before X11 (OpenWindows) started up on it
when you first logged in.  (Or it may be that you're on a remote display,
and the xterm is getting whatever settings some other process applied to
the system console.)

} It is ok if xterm is invoked on foreground.

It's OK then because the foreground xterm can still open a controlling
tty (that of the parent shell) from which to copy the settings.

} This problem never occurs on tcsh, csh, or sh.

I've seen it happen with shells other than zsh, usually when running some
non-shell program with `xterm -e ...'.  There may be something about the
way zsh spawns background jobs that makes it more likely.

There are several possible workarounds:

If you have a modern version of xterm, there is a resource XTerm*ttyModes
that you can use to specify stty settings for all xterms that start up.
That resource was created for this problem; it is the best solution.

In your shell initialization files, force the console to have sane stty
values before you start openwin.  This may not work if openwin itself
is what's messing up the console settings, or if you're logging in via
a remote display.

Start all xterms as login shells (XTerm*loginShell: true, I believe),
so .zlogin gets read (I presume you have stty commands there for your
initial login terminal settings).  This may be undesirable, and won't
help for `xterm -e ...' where the xterm is not running a zsh.

Put a test `[[ -t 0 ]] && stty ...' in your .zshenv, to force the settings
be sane for any zsh that starts with a terminal as standard input.  This
won't work for `xterm -e ...' either.

Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

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