Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 00ce20ee616b47b5b845790b1ed4a4de39c96b04 1 parent 260c0a6
@rcaputo authored
Showing with 26 additions and 3 deletions.
  1. +26 −3 poe/lib/POE/Wheel/Run.pm
View
29 poe/lib/POE/Wheel/Run.pm
@@ -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;
Please sign in to comment.
Something went wrong with that request. Please try again.