BLOCKING and STDOUT/STDERR

Discussion in 'Perl Misc' started by George C. Demetros, Jan 6, 2004.

  1. Hi.

    We have a Perl routine that prints messages to STDOUT and STDERR. It's possible
    that the calling function may have redirected STDOUT/STDERR to FIFO files, and
    the Perl routine is unaware of this. It appears that if the FIFO files are not
    being read and that the files approach the 32K limit in size, that some sort of
    blocking occurs in the Perl routine.

    Is there some way of determining, within the Perl routine, when we hit this
    limit and/or when blocking occurs so we can gracefully die? Again, the Perl
    routine is unaware whether the calling function has redirected STDOUT/STDERR.

    Thanks in advance!

    George
     
    George C. Demetros, Jan 6, 2004
    #1
    1. Advertisements

  2. George C. Demetros

    Ben Morrow Guest

    The way to deal with this is to use non-blocking IO, which will fail
    if the data cannot be written due to a full buffer. See
    IO::Handle::blocking.

    Ben
     
    Ben Morrow, Jan 6, 2004
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.