in reply to Re: I got IPC::Open3 to work!
in thread I got IPC::Open3 to work!

It doesn't look like you're handling partial reads

He does. Relevant code:

while(my @ready = $select->can_read) { ... my $data; my $length = sysread $fh, $data, 4096; ... $processeddata .= $data; ... }

All the data ends up in processeddata, no matter how much is read by a given call to sysread.

It doesn't look like you're handling ... other exceptional conditions

He does this too. Relevant code:

if( ! defined $length || $length == 0 ) { $err .= "Error from child: $!\n" unless defined $length; $select->remove($fh); }

The filehandle is removed from the list of handles monitored by select. I'm guessing can_read will return false when it no longer monitors any handles.

Something like this might be a start.

That's bad! You removed select, which is cruicial here.

Replies are listed 'Best First'.
Re^3: I got IPC::Open3 to work!
by siracusa (Friar) on Jul 23, 2005 at 12:36 UTC
    All the data ends up in processeddata, no matter how much is read by a given call to sysread.

    Oops, my bad. Actually, hm, I'm not sure what happens without the offset adjustments that I have in my code...

    It doesn't look like you're handling ... other exceptional conditions

    He does this too. Relevant code:

    if( ! defined $length || $length == 0 ) { $err .= "Error from child: $!\n" unless defined $length; $select->remove($fh); }

    That treats things like EINTR as "fatal" errors (stop listening on that $fh), which is probably not what he wants.

    You removed select, which is cruicial here.

    I was just commenting on the vagaries of sysread().

      Anything unexpected here is a fatal error. Unfortunately, I spent so much time getting this to work at all my boss isn't willing to devote any more time on the finer points. It'll end up biting me in the ass later, but I'm logging any error messages and autoforwarding these to my phone so I can fix (or at least be aware) them before my boss finds out.

      Harley J Pig