[SCM] libmessage-passing-perl Debian packaging branch, master, updated. debian/0.111-3-14-g44f6e88
Tomas Doran
tomas.doran at timgroup.com
Mon May 6 11:57:54 UTC 2013
The following commit has been merged in the master branch:
commit f4adabbd716a9276067be620add9bd30481cdc3b
Author: Tomas Doran <tomas.doran at timgroup.com>
Date: Mon Oct 8 16:51:02 2012 +0100
Fix FileTail harder
diff --git a/Changes b/Changes
index c466ccf..c384d3d 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,6 @@
- Fix v-string to work with perl 5.8. RT#80034
+ - Fix issues stopping multiple FileTail inputs being used in the
+ same process.
0.109
- Really fix test fail :(
diff --git a/lib/Message/Passing/Input/FileTail.pm b/lib/Message/Passing/Input/FileTail.pm
index 623613f..6f12581 100644
--- a/lib/Message/Passing/Input/FileTail.pm
+++ b/lib/Message/Passing/Input/FileTail.pm
@@ -5,6 +5,7 @@ use AnyEvent;
use Scalar::Util qw/ weaken /;
use POSIX ":sys_wait_h";
use Sys::Hostname::Long;
+use AnyEvent::Handle;
use namespace::clean -except => 'meta';
use constant HOSTNAME => hostname_long();
@@ -48,23 +49,34 @@ sub _build_tail_handle {
die("Cannot open filename '" . $self->filename . "'") unless -r $self->filename;
my $child_pid = open(my $r, "-|", "tail", "-F", $self->filename)
|| die "can't fork: $!";
- AnyEvent->io(
+ my $hdl;
+ my $_handle_error = sub {
+ my $i; $i = AnyEvent->idle(cb => sub {
+ undef $i;
+ $hdl->destroy;
+ undef $hdl;
+ close($r);
+ $self->_tail_handle;
+ });
+ };
+ $hdl = AnyEvent::Handle->new(
fh => $r,
- poll => "r",
- cb => sub {
- my $input = scalar <$r>;
- if (!defined $input) {
- $self->_clear_tail_handle;
- my $i; $i = AnyEvent->idle(cb => sub {
- undef $i;
- close($r);
- $self->_tail_handle;
- });
- return;
- }
- $self->_emit_line($input);
- },
+ on_error => $_handle_error,
+ on_eof => $_handle_error,
);
+ $hdl->push_read(line => sub {
+ my ($hdl, $input) = @_;
+ if (!defined $input) {
+ $self->_clear_tail_handle;
+ my $i; $i = AnyEvent->idle(cb => sub {
+ undef $i;
+ close($r);
+ $self->_tail_handle;
+ });
+ return;
+ }
+ $self->_emit_line($input);
+ });
}
sub BUILD {
--
libmessage-passing-perl Debian packaging
More information about the Pkg-perl-cvs-commits
mailing list