Control + C在bash中的timeout-child进程中不起作用

时间:2013-12-10 07:42:41

标签: bash timeout child-process

这是一个简单的两级脚本:

test.sh

#!/bin/bash
timeout 100 ./test-inner.sh

test-inner.sh

#!/bin/bash
sleep 100000

并执行

./test.sh

如果我尝试通过Control + C杀死test.sh进程,它就不起作用。 你可以帮助我离开这里吗?

1 个答案:

答案 0 :(得分:0)

超时 程序可能具有信号处理程序,可由用户使用--foreground选项进行配置。 正如您在手册页中看到的那样:

   --foreground

          When not running timeout directly from  a  shell  prompt,  allow
          COMMAND  to  read from the TTY and receive TTY signals.  In this
          mode, children of COMMAND will not be timed out.