in reply to "tee"ing my own stdout/stderr
The tee created by open STDOUT, '|-', tee => $outfile will capture the output of children too, but it won't work well with a custom SIGINT handler.
The tee created by IO::Tee will work with a custom SIGINT handler, but it won't capture the output of executed children.
It sounds like you want to capture the output of children and use a custom SIGINT. Based on my testing, the following does that:
open(STDOUT, '|-', bash => ( -c => 'trap "" INT ; tee -- "$0"', $outfile, ) ) or die;
Update: Since this is a common problem, tee actually provides a fix for it in the form of -i:
open(STDOUT, '|-', tee => ( '-i', '--', $outfile ) ) or die;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: "tee"ing my own stdout/stderr
by conrad (Beadle) on Jun 07, 2010 at 17:31 UTC |