in reply to Command output to screen and logfile buffering problem
select STDERR; $| = 1; select STDOUT; $| = 1; open(CMD, 'perl b.pl 2>&1|') or die $!; open(LOGFILE, '>', 'b.log') or die $!; my $input; while(sysread(CMD, $input, 1024)) { print $input; print LOGFILE $input; } close(CMD);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Command output to screen and logfile buffering problem
by eyepopslikeamosquito (Archbishop) on May 28, 2003 at 02:08 UTC |