为什么我会收到“已暂停(tty输出)"消息?在一个航站楼而不在其他航站楼? [英] why do I get "Suspended (tty output)" in one terminal but not in others?
问题描述
显然,我在tcsh shell中做了一些奇怪的/错误的事情,现在每当我在后台启动一个应用程序并打印到标准输出时,该应用程序就会被暂停(停止).奇怪的是,此行为仅在此终端中发生;如果我在另一个终端上执行相同的操作,则该应用程序将继续在后台运行,并将其输出打印到终端上.
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.
在损坏的"终端中,我必须将挂起的应用程序放回前台(使用fg
),以使其继续运行.
In the "broken" terminal I have to put the suspended application back into foreground (with fg
) to have it continue.
示例:
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)>
在受影响的终端中启动bash并不能解决此问题:
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$
使用(su - oliver
)获取新的登录外壳也无法解决此问题.
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 :-)
发生在具有KDE 4.11.5和Konsole 2.11.3以及tcsh 6.17.00的Linux RHEL 6.4 64位上.
Happens on Linux RHEL 6.4 64bit, with KDE 4.11.5 and Konsole 2.11.3, and tcsh 6.17.00.
推荐答案
它将解决此问题:
stty -tostop
在手册页中:
停止(-停止)
tostop (-tostop)
发送(不发送)SIGTTOU作为后台输出.如果后台作业尝试进行终端输出,则会导致这些作业停止.
Send (do not send) SIGTTOU for background output. This causes background jobs to stop if they attempt terminal output.
此tostop
通常是默认设置,因为通常不希望混合多个作业的输出.因此,大多数人只希望前台作业能够打印到终端.
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.
这篇关于为什么我会收到“已暂停(tty输出)"消息?在一个航站楼而不在其他航站楼?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!