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
,但请注意管道破裂。