On Mon, Feb 17, 2003 at 07:02:41PM -0500, Wiggins d'Anconia wrote:
> 
> Rocco Caputo wrote:
> >On Wed, Feb 12, 2003 at 08:38:25AM +1100, [EMAIL PROTECTED] wrote:
> >
> <snip>
> >
> >It's a valid interpretation of ErrorEvent, but it's not the way
> >POE::Wheel::Run was written.
> >
> >StdoutEvent, StderrEvent, and ErrorEvent refer to the pipes that
> >attach the parent and child processes.  The first two provide child
> >output that is received on those pipes, and the third lets you know if
> >there are errors reading from them.
> >
> >A child program's return value comes to you differently: through
> >SIGCHLD.  If it's significant, you'll need to set up a SIGCHLD handler
> >and match the returned process ID against the process ID of your
> >active wheel.

[sample code for using a CHLD signal handler to catch return values]

> Should the above be added to the POE::Wheel::Run docs or on the cookbook 
> page possibly?  I think this is a good example of what should be done, 
> and was also confused by how the docs are worded.  It also appeared to 
> me that the "CloseEvent" was *the* way to find out that the process was 
> complete, when clearly it is really just when STDOUT is closed, granted 
> this should happen when the process is over.  I haven't had a chance to 
> work the above into my app yet but it definitely closes one question I 
> had lingering....

Probably yes.  There also needs to be a tutorial on
POE::Component::Child, which supplies a lot of the support code you
might otherwise need to write for POE::Wheel::Run.  It even handles
SIGCHLD for you, supplying a "died" event that includes the return
code.

If anybody would like to supply a POE::Component::Child example for
the cookbook, please do.

-- Rocco Caputo - [EMAIL PROTECTED] - http://poe.perl.org/

Reply via email to