my $pid = open STDOUT, '|-'; unless ($pid) { defined $pid or die "unable to fork new process: $!"; open my $tee, '>>', $stdout_log_fn or die "unable to open '$stdout_log_fn'"; select $tee; $| = 1; select STDOUT; $| = 1; while (<>) { print $tee "OUT $_"; print $_; } exit(0); } # and repeat for STDERR
In reply to Re^2: How to log all output from a program?
by salva
in thread How to log all output from a program?
by absolut.todd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |