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 = ''; } } }

In reply to Re: wxperl Installer Script Logging by Loops
in thread wxperl Installer Script Logging by jmlynesjr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.