为什么我得到“暂停(tty 输出)"?在一个终端而不是在其他终端? [英] why do I get "Suspended (tty output)" in one terminal but not in others?

查看:34
本文介绍了为什么我得到“暂停(tty 输出)"?在一个终端而不是在其他终端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显然我在 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$ 

获得一个新的登录 shell(使用 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 :-)

在 Linux RHEL 6.4 64 位、KDE ​​4.11.5 和 Konsole 2.11.3 以及 tcsh 6.17.00 上发生.

Happens on Linux RHEL 6.4 64bit, with KDE 4.11.5 and Konsole 2.11.3, and tcsh 6.17.00.

推荐答案

这将解决它:

stty -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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆