The shell should handle tty modes along with job control
news at usenet.ins.cwru.edu
news at usenet.ins.cwru.edu
Wed Nov 14 03:39:51 AEST 1990
In article <108290 at convex.convex.com> tchrist at convex.COM (Tom Christiansen) writes:
>The (t)csh I've used for the last 5 years or so has always
>done pretty much the right thing with modes. That is, it restores
>your tty to the state it was in before calling the program. It
>does seem to know to do the right thing with stty changes, although
>I haven't looked to see how it does that.
Bash uses the exit status of commands to decide whether or not to restore
the terminal modes. If a command exits successfully (that is, it does not
exit with a status indicating that it was killed by a signal), bash saves
the tty settings; if one exits via a signal or stops, the tty state is set
back to the saved settings. This takes care of stty, for instance.
For the morbidly curious, here's the code :-)
if (job != NO_JOB && interactive)
{
if (WIFSIGNALED (child->status) || WIFSTOPPED (child->status))
set_tty_state ();
else
get_tty_state ();
notify_and_cleanup ();
}
Chet
--
Chet Ramey ``I die, Horatio''
Network Services Group, Case Western Reserve University
chet at ins.CWRU.Edu
My opinions are just those, and mine alone.
More information about the Comp.unix.programmer
mailing list