in reply to wxperl Installer Script Logging

You may be able to avoid input prompts as suggested above, but in situations where you can't, one option is to print the last few lines after no output is detected for awhile. So output is suppressed unless the installer is sitting at a prompt for a bit. Usually the extra few seconds don't matter if the user is waiting for a long compile anyway.

The script below will act like a null sink until output quieces, then it will print the most recent 5 output lines. Pipe the output of tee in your current command line into:

my $timeout = 10; # Seconds to wait, before printing select *STDOUT; $| = 1; # Set standard output to auto flush while (1) { my $buf = my $in = ''; eval { local $SIG{ALRM} = sub { print $buf,$in; die }; while (1) { alarm $timeout; sysread *STDIN, $in, 500 or exit; alarm 0; ($buf) = ($buf.$in) =~ m/((.*?\n){0,4}.*?\n?)$/; $in = ''; } } }