Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Buffer the stdout before checking it, and add a $term(inator) parameter.

  • Loading branch information...
commit 7bab034b67f39b4eaa3b97709b6609077bcf660c 1 parent b129895
Philip Gwyn authored committed
Showing with 13 additions and 4 deletions.
  1. +13 −4 lib/POE/Test/Loops/wheel_run.pm
View
17 lib/POE/Test/Loops/wheel_run.pm
@@ -544,7 +544,7 @@ sub silent_start {
select STDOUT; $|=1;
eval "print STDOUT 'CHILD:'";
eval 'my $input = <STDIN>; chomp($input); print STDERR $input;';
- eval 'print STDERR "CHILD:";';
+ eval 'print STDERR "DONE:";';
close STDOUT;
close STDERR;
exit(0);
@@ -587,18 +587,27 @@ sub silent_start {
}
sub _silent_check_common {
- my ($fh,$re,$desc) = @_;
+ my ($fh,$re,$desc,$a,$term) = @_;
sysread($fh, my $buf = "", 8192);
+ if( $a ) {
+ $$a = '' unless defined $$a;
+ $$a .= $buf;
+ return unless $$a =~ $term;
+ }
+
like($buf, $re, $desc);
$poe_kernel->select_read($fh);
close($fh);
}
+my $ACCUME;
sub silent_got_stdout {
_silent_check_common(
$_[ARG0],
- qr/CHILD:PARENT:CHILD:/,
- "stdio/redirection"
+ qr/CHILD:PARENT:DONE:/,
+ "stdio/redirection",
+ \$ACCUME,
+ qr/DONE/
);
}
Please sign in to comment.
Something went wrong with that request. Please try again.