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.
How to resume a suspended (tty input) process [unix/mac]?
To add to the Chaitanya Bapats answer,
you can use jobs
command to list the suspended jobs. The output will be something like this if you have more than one suspended jobs.
[1] - suspended sleep 400
[2] + suspended sleep 300
You can bring the job to foreground by using fg
. If you have more than one suspended jobs, then you can use fg %ID
. ID is the value inside []
in the output of jobs
command.
Also, if you want to resume the job without bringing it to the foreground, you can use kill -CONT
command. Example usage:
kill -CONT JOBID
You can also use bg
command to move job to background. bg
will resume the last suspended job. Also, bg %ID
will resume the job with [ID]
in jobs command output
How does launching `less` differ from launching `cat` in ZSH with regards to the usage of alternate screen and background suspension
(you don't specify your OS, but this answer is based on linux)
Using strace
you can see stty
doing an ioctl
on fd 0 (stdin) toggling one bit in the c_lflag
value of the termios struct.
strace
also reveals that less
will open /dev/tty
and issue an ioctl
on it to change the c_lflag
.
So less
simply does the same thing as stty tostop
before outputting anything.
Related Topics
Embed Icc Color Profile in PDF
Does Linking an '-Lpthread' Changes Application Behaviour? (Linux, Glibc)
How to Display Only Files from Aws S3 Ls Command
How Is Stack Size of Linux Process Related to Pthread, Fork and Exec
Replace a Text with a Variable
How to Return Spawned Process Exit Code in Expect Script
Using Perf Probe to Monitor Performance Stats During a Particular Function
"Stdin: Is Not a Tty" from Cronjob
Move Files That Are 30 Minutes Old
Replace String in a File with Value from Another File
How Is the Address of the Text Section of a Pie Executable Determined in Linux
Debugging Shared Libraries with Gdbserver
Setup Cron Tab to Specific Time of During Weekdays
Merging Through Fuzzy Matching of Variables in R
How to Find Out What Linux Capabilities a Process Requires to Work
Gdb Break When Program Opens Specific File
PDF Lib Install Fail on Linux Server. Using Pecl Install PDFlib