Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Apply Stephen Oberholtzer's patch to fix a test freeze.

IO::Handle->blocking() is broken on MSWin32, locking up
t/10_units/04_drivers/01_sysrw.t in some cases.  Stephen provided a
patch to Perl and to POE to work around the issue.  It's portable
enough that things shouldn't immediately break after Perl is fixed.

Resolves rt.cpan.org ticket #69769.
  • Loading branch information...
commit 758904f7dbae504a3de97f8b5178d00b7a2aea51 1 parent 32db4fe
@rcaputo authored
Showing with 10 additions and 6 deletions.
  1. +10 −6 t/10_units/04_drivers/01_sysrw.t
View
16 t/10_units/04_drivers/01_sysrw.t
@@ -106,8 +106,8 @@ nonblocking($r);
# Number of flushed octets == number of read octets.
-{ my $flushed_count = write_until_pipe_is_full($d, $w);
- my $read_count = read_until_pipe_is_empty($d, $r);
+{ my ($flushed_count, $full) = write_until_pipe_is_full($d, $w);
+ my ($read_count) = read_until_pipe_is_empty($d, $r);
ok(
$flushed_count == $read_count,
@@ -174,6 +174,7 @@ exit 0;
sub write_until_pipe_is_full {
my ($driver, $handle) = @_;
+ # Hopefully bigger than any system buffer ever.
my $big_chunk = "*" x (1024 * 1024);
my $flushed = 0;
@@ -181,18 +182,21 @@ sub write_until_pipe_is_full {
while (1) {
# Put a big chunk into the buffer.
- my $buffered = $driver->put([ $big_chunk ]);
+ my $buffered = $driver->put([ $big_chunk ]);
# Try to flush it.
my $after_flush = $driver->flush($handle);
- # Flushed amount.
+ # How much was flushed?
$flushed += $buffered - $after_flush;
- # The pipe is full if there's data after the flush.
+ # If there's data left, then this flush failed.
last if $after_flush;
}
+ if (wantarray) {
+ return ($flushed, $full);
+ }
return $flushed;
}
@@ -245,7 +249,7 @@ sub nonblocking {
eval { binmode *$handle };
# Turn off blocking.
- eval { $handle->blocking(0) };
+ eval { $handle->blocking(0); $handle->blocking(); };
# Turn off buffering.
CORE::select((CORE::select($handle), $| = 1)[0]);
Please sign in to comment.
Something went wrong with that request. Please try again.