Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 为什么我会得到;暂停(tty输出)";在一个终端,但不在其他终端?_Linux_Shell_Terminal_Rhel - Fatal编程技术网

Linux 为什么我会得到;暂停(tty输出)";在一个终端,但不在其他终端?

Linux 为什么我会得到;暂停(tty输出)";在一个终端,但不在其他终端?,linux,shell,terminal,rhel,Linux,Shell,Terminal,Rhel,显然,我在tcsh shell中做了一些奇怪/错误的事情,现在每当我在后台启动一个应用程序并打印到stdout时,应用程序就会被挂起(停止)。奇怪的是,这种行为只发生在这个终端;如果我在另一个终端上执行同样的操作,应用程序只会在后台继续运行,并将其输出打印到终端 在“断开”的终端中,我必须将挂起的应用程序放回前台(使用fg)才能继续 例如: thehost:/tmp/test1(277)> ls -l & [3] 1454 thehost:/tmp/test1(278)>

显然,我在tcsh shell中做了一些奇怪/错误的事情,现在每当我在后台启动一个应用程序并打印到stdout时,应用程序就会被挂起(停止)。奇怪的是,这种行为只发生在这个终端;如果我在另一个终端上执行同样的操作,应用程序只会在后台继续运行,并将其输出打印到终端

在“断开”的终端中,我必须将挂起的应用程序放回前台(使用
fg
)才能继续

例如:

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)> 
在另一个终端中执行的相同命令可以正常工作:

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也不能解决此问题:

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
)也不能解决这个问题

那么:我在这个终端中做了什么来获得这种行为,以及我能做什么来恢复正常行为?这不是一个真正重要的问题(我可以关闭终端并打开一个新的),但我很好奇:-)

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

这将解决此问题:

stty -tostop
从手册页:

tostop(-tostop)

为后台输出发送(不发送)信号。这会导致后台作业在尝试终端输出时停止


tostop
通常是默认设置,因为通常不希望混合多个作业的输出。因此,大多数人只希望前台作业能够打印到终端。

没有为我修复它。不幸的是:c试图在后台运行多个gradle构建,但它们都是挂起的。构建脚本中的某些内容是否可以更改
stty
设置?
stty--all
显示了什么?这是:我确信构建脚本中的stty设置不会改变。我使用zsh-btw。这是启动每个构建的命令:
(gradle-build-no-daemon-console=rich&>“/tmp/build-$(basename$d)”)&
可能zsh管理的后台进程与bash不同。相关内容: