git: a7eac018437e - main - stty(1): provide details about interaction with job control

From: Konstantin Belousov <>
Date: Sun, 02 Oct 2022 17:31:35 UTC
The branch main has been updated by kib:


commit a7eac018437e592a575f46a59151eedc7a742fa7
Author:     Konstantin Belousov <>
AuthorDate: 2022-09-26 21:34:22 +0000
Commit:     Konstantin Belousov <>
CommitDate: 2022-10-02 17:29:53 +0000

    stty(1): provide details about interaction with job control
    Describe a shell trick to do non-blocking modification of the terminal
    settings, by ignoring job control signals with trap built-in.
    PR:     266627
    With input from:        jilles
    Reviewed by:    pauamma
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:
 bin/stty/stty.1 | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/bin/stty/stty.1 b/bin/stty/stty.1
index 67a32c089150..83f5d4da0b82 100644
--- a/bin/stty/stty.1
+++ b/bin/stty/stty.1
@@ -32,7 +32,7 @@
 .\"     @(#)stty.1	8.4 (Berkeley) 4/18/94
 .\" $FreeBSD$
-.Dd May 24, 2022
+.Dd September 27, 2022
 .Dt STTY 1
@@ -594,6 +594,32 @@ Same as the control character
 Same as the control character
 .Cm reprint .
+Modifications to the terminal settings are treated by job control
+.Xr termios 4 )
+same as writes.
+When the
+utility is executing in a background process group,
+such attempts result in the kernel sending the
+signal and stopping the process until its group is returned
+to foreground.
+The non-blocking open of the terminal device with the
+.Fl f
+option to
+does not affect the behavior.
+If it is desirable to modify the settings from the background,
+.Xr sh 1
+users might utilize the following idiom:
+.Bd -literal
+(trap '' TTOU; stty -f /dev/tty sane)
+Note that changing terminal settings for a running foreground
+job that is not prepared for it might cause inconsistencies.
 .Ex -std