Perl INT handler and Bash STDERR redirection



foo.pl捕获INT信号,即 Ctrl-C.

foo.pl按预期工作。

使用foo.pl 2>&1 | tee foo.log信号捕获似乎不起作用。

有什么线索吗?

当你说:

foo.pl 2>&1 | tee foo.log

然后 CtrlC 会导致tee终止,从而将SIGPIPE发送到管道中的早期进程。

似乎您想抓住SIGPIPE,但请注意管道破裂。

最新更新