Skip Menu |

This queue is for tickets about the IPC-Run CPAN distribution.

Report information
The Basics
Id: 101997
Status: resolved
Priority: 0/
Queue: IPC-Run

People
Owner: Nobody in particular
Requestors: user42_kevin [...] yahoo.com.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: suggest option for blocking output pipe
Date: Sun, 08 Feb 2015 15:16:15 +1100
To: bug-IPC-Run [...] rt.cpan.org
From: Kevin Ryde <user42_kevin [...] yahoo.com.au>
I wanted to start a subprocess and send it data through a pipe like the program below, but found run() "<pipe" handle is non-blocking, when printing a big block or faster than the child reads (EWOULDBLOCK or EAGAIN). Error from print to pipe: Resource temporarily unavailable at foo.pl line 5. It could be good if the docs of "<pipe" described the non-blocking, under the bit "The <pipe operator opens the write half of a pipe ...". I presume the motivation is to allow simultaneous read and write or for a master process to do other things when some child is not ready. It could also be good to have an option for a blocking output pipe. I see there's some deliberate fcntl() to turn off blocking, so the option would not do that. I think this would be useful in various cases where the perl program is setting itself up as the start of a pipeline and so should write at the pace of the child.
use strict; use IPC::Run; my $harness = IPC::Run::start(['wc'], '<pipe', \*WC) or die "Cannot run cat"; print WC "blah blah\n" x 32768 or die "Error from print to pipe: $!"; close WC or die "Error closing pipe"; $harness->finish;
Ticket migrated to github as https://github.com/toddr/IPC-Run/issues/64