Skip Menu |

This queue is for tickets about the POE CPAN distribution.

Report information
The Basics
Id: 38908
Status: resolved
Worked: 10 min
Priority: 0/
Queue: POE

People
Owner: Nobody in particular
Requestors: MSCHILLI [...] cpan.org
Cc: dolmen [...] cpan.org
AdminCc:

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



Subject: POE::Wheel::Run: No CloseEvent unless StderrEvent defined
Just stubled across this odd POE::Wheel behavior, would be great if you could take a look: In the following code snippet, POE::Wheel::Run doesn't jump to the "close_state" defined as the wheel's CloseEvent: use POE; use POE::Wheel::Run; POE::Session->create( inline_states => { _start => sub { my($heap) = @_[HEAP]; $heap->{wheel} = POE::Wheel::Run->new( Program => "cat", ProgramArgs => ["/dev/null"], CloseEvent => "close_state", StdinEvent => "blah", ); }, close_state => sub { my($heap) = @_[HEAP]; delete $heap->{ wheel }; print "Closed!\n"; }, }, ); POE::Kernel->run(); If you comment out #StdinEvent => "blah", and put in StderrEvent => "blah", instead, it works. On a completly unrelated subject, if you add POE::Kernel->sig(CHLD => "your_event"); right before the kernel run() call (not sure if that makes sense since at this point there's no current session, but nevertheless), the program doesn't terminate. Would be great if you could check it out, thanks! -- Mike
I'm also a user of this module, not the maintainer. Le Mar. Sep. 02 03:32:14 2008, MSCHILLI a écrit : Show quoted text
> In the following code snippet, POE::Wheel::Run doesn't jump to the > "close_state" defined as the wheel's CloseEvent: > $heap->{wheel} = POE::Wheel::Run->new( > Program => "cat", > ProgramArgs => ["/dev/null"], > CloseEvent => "close_state", > StdinEvent => "blah", > );
Are you sure you want to monitor STDIN and not STDOUT instead? I don't see the point. What kind of event can come from STDIN? Show quoted text
> On a completly unrelated subject, if you add > > POE::Kernel->sig(CHLD => "your_event"); > > right before the kernel run() call (not sure if that makes sense since > at this point there's no current session, but nevertheless), the program > doesn't terminate. > > Would be great if you could check it out, thanks! > > -- Mike
I had success in defining the SIGCHLD handler like this in my _start event: my $child = POE::Wheel::Run-new(...); $_[KERNEL]->sig_child($child->PID, 'sig_chld');
Regarding CloseEvent, it only pertains to the child process' output file handles. I don't recall what the 1.003 documentation said, but the latest to-be-released version reads: CloseEvent contains the name of an event that the wheel will emit when the child process closes its last open output handle. This is a consistent notification that the child is done sending output. Please note that it does not signal when the child process has exited. Programs should use sig_child() to detect that. ... Would you explain your use case? I haven't considered the need to recognize when the child had closed its STDIN without also closing the resto of its stdio. Thank you.
Revision 2620 adds a fix for a case where CloseEvent isn't sent. It sounds like a different issue than the one reported here, but perhaps they're related? It would be helpful if you could test against the latest version of POE (at https://poe.svn.sourceforge.net/svnroot/poe/trunk/poe in the repository) and let us know whether that fixes things for you. Thank you.
No response in 4 months. Assuming the last change is good. Thank you for the bug report.