Permalink
Browse files

Fix case where POE::Wheel::Run CloseEvent doesn't fire on Linux.

Thanks to Philip Gwyn's investigation and test cases, we found out
that close() wasn't sufficient to close and destruct slave ptys, so
the parent processes were keeping them open.  Replaced close() with
$io_pty->close_slave() as needed.
  • Loading branch information...
rcaputo committed Aug 6, 2009
1 parent 260c0a6 commit 00ce20ee616b47b5b845790b1ed4a4de39c96b04
Showing with 26 additions and 3 deletions.
  1. +26 −3 poe/lib/POE/Wheel/Run.pm
View
@@ -454,9 +454,32 @@ sub new {
}
# Parent here. Close what the parent won't need.
- close $stdin_read if defined $stdin_read;
- close $stdout_write if defined $stdout_write;
- close $stderr_write if defined $stderr_write;
+ if (defined $stdin_read) {
+ if (ref($stdin_read) eq 'IO::Pty') {
+ $stdin_read->close_slave();
+ }
+ else {
+ close $stdin_read;
+ }
+ }
+
+ if (defined $stdout_write) {
+ if (ref($stdout_write) eq 'IO::Pty') {
+ $stdout_write->close_slave();
+ }
+ else {
+ close $stdout_write;
+ }
+ }
+
+ if (defined $stderr_write) {
+ if (ref($stderr_write) eq 'IO::Pty') {
+ $stderr_write->close_slave();
+ }
+ else {
+ close $stderr_write;
+ }
+ }
my $active_count = 0;
$active_count++ if $stdout_event and $stdout_read;

0 comments on commit 00ce20e

Please sign in to comment.