Skip to content

Commit

Permalink
POE::Pipe and its subclasses work best using Cygwin's pipe(), not IO:…
Browse files Browse the repository at this point in the history
…:Socket.

Previous Cygwin versions work better with sockets.  If 01_sysrw.t hangs for
you, upgrade your Cygwin and its Perl.
  • Loading branch information
rcaputo committed Feb 15, 2010
1 parent 22ec336 commit 70ffdd8
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions t/10_units/04_drivers/01_sysrw.t
Expand Up @@ -97,18 +97,8 @@ ok( $d->get_out_messages_buffered() == 1, "one message buffered" );
}

# Remaining tests require some live handles.
# cygwin seems to block on syswrite() and close() even though a handle
# is non-blocking. Force the pipe to use Internet domain sockets.
# This solves the syswrite() problem. Later we call shutdown(2) on
# the write side rather than close(), which solves that end of things.

my ($r, $w);
if ($^O eq "cygwin") {
($r, $w) = POE::Pipe::OneWay->new("inet");
}
else {
($r, $w) = POE::Pipe::OneWay->new();
}

my ($r, $w) = POE::Pipe::OneWay->new();
die "can't open a pipe: $!" unless $r;

nonblocking($w);
Expand Down Expand Up @@ -139,12 +129,7 @@ while (flush_remaining_buffer($d, $w)) {
# Get() returns undef ($! == 0) on EOF.

{ write_until_pipe_is_full($d, $w);
if ($^O eq "cygwin") {
shutdown($w, 2);
}
else {
close($w);
}
close($w);

open(SAVE_STDERR, ">&STDERR") or die $!;
close(STDERR) or die $!;
Expand Down

0 comments on commit 70ffdd8

Please sign in to comment.