in reply to Re: How to log all output from a program?
in thread How to log all output from a program?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to log all output from a program?
by shmem (Chancellor) on Oct 15, 2007 at 08:50 UTC | |
by salva (Canon) on Oct 15, 2007 at 09:10 UTC | |
|
Re^3: How to log all output from a program?
by salva (Canon) on Oct 16, 2007 at 21:42 UTC |