why do I get "Suspended (tty output)" in one terminal but not in others?
This will fix it:
stty -tostop
From the man page:
tostop (-tostop)
Send (do not send) SIGTTOU for background output. This causes background jobs to stop if they attempt terminal output.
This tostop
is normally the default setting, as it's usually undesirable to mix the output of multiple jobs. So most people just want the foreground job to be able to print to the terminal.
Related videos on Youtube
oliver
Updated on July 09, 2022Comments
-
oliver almost 2 years
Apparently I've done something strange/wrong in a tcsh shell, and now whenever I start an application in the background which prints to stdout the application is suspended (stopped). Weird thing is, this behavior only happens in this terminal; if I do the same in another terminal, the application just keeps running in the background and prints it output to the terminal.
In the "broken" terminal I have to put the suspended application back into foreground (with
fg
) to have it continue.Example:
thehost:/tmp/test1(277)> ls -l & [3] 1454 thehost:/tmp/test1(278)> [3] + Suspended (tty output) ls --color=auto -l thehost:/tmp/test1(278)> fg ls --color=auto -l total 0 thehost:/tmp/test1(279)>
Same command executed in another terminal works fine:
thehost:/tmp/test1(8)> ls -l & [1] 2280 thehost:/tmp/test1(9)> total 0 [1] Done ls --color=auto -l thehost:/tmp/test1(9)>
Starting a bash in the affected terminal doesn't solve this either:
thehost:/tmp/test1(280)> bash oliver@thehost:/tmp/test1$ ls -l & [1] 2263 oliver@thehost:/tmp/test1$ [1]+ Stopped ls --color=auto -l oliver@thehost:/tmp/test1$ fg ls --color=auto -l total 0 oliver@thehost:/tmp/test1$
Getting a new login shell (with
su - oliver
) doesn't solve this either.So: what did I do in this terminal to get this behavior, and what can I do to get back the normal behavior? It's not really an important problem (I could close the terminal and open a new one), but I'm curious :-)
Happens on Linux RHEL 6.4 64bit, with KDE 4.11.5 and Konsole 2.11.3, and tcsh 6.17.00.
-
Melebius over 4 years
-
-
xeruf over 5 yearsdid not fix it for me unfortunately :c Trying to run multiple gradle builds in the background, but they are all suspended
-
Barmar over 5 yearsCould something in the build script be changing the
stty
settings? What doesstty --all
show? -
xeruf over 5 yearsThis: pastebin.com/nGzySBS2 I am sure that nothing changes the stty settings in the buildscripts. I use zsh btw. This is the command that starts each build:
(gradle build --no-daemon --console=rich &>"/tmp/build-$(basename $d)") &
-
Barmar over 5 yearsMaybe zsh manages background processes differently from bash.