作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要检测我的后台进程之一何时退出。因此,我安装了一个陷阱。 run_gui
和 run_ai1
是简单的 exec
函数。
run_gui & gui_pid=$!
run_ai1 & ai1_pid=$!
trap 'echo foo' SIGCHLD
while true; do
echo "Started the loop"
while true; do
read -u $ai1_outfd line || echo "Nothing read"
if [[ $line ]]; then
: # Handle this
fi
done
while true; do
read -u $gui_outfd line || echo "nothing read"
if [[ $line ]]; then
: # Handle this
fi
done
done
当我关闭 GUI 时,没有任何反应。 echo foo
命令只有在我按下 ctrl+c 时才会执行。
为什么我错过了 SIGCHLD
?
最佳答案
Non-interactive shells don't enable job control by default. See if putting 'set -o monitor' at the beginning of the script produces the results you want.
来源:Chet Ramey , GNU Bash 的维护者
关于bash - 进程退出时未传递 SIGCHLD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37552755/
在我们的数据库表上,我们使用两个唯一的非聚集索引来创建跨四个字段的唯一约束。我们使用两个,因为其中一个字段 ZipCode 是一个可为空的字段。如果表中存在一条包含 ZipCode 的 null 条目
我刚刚开始学习 Rails 3 教程,以便对框架有一点熟悉,但我在生成 schema.rb 时遇到了问题。我的操作系统是 Windows 7 x64、Ruby 1.9.2、MySQL2 gem 0.2
我是一名优秀的程序员,十分优秀!