Subject: | Term::ReadLine::Gnu::XS + IO::Async patch |
Hi there,
Just a quick patch to update the IO::Async support: current code fails due to $fh not supporting the ->fileno method. This might only affect Term::ReadLine::Gnu::XS, since the 10-IO-Async.t test case is passing.
The patch wraps the $fh in an IO::Handle, giving IO::Async::Handle something it can call ->fileno on.
(it's possible that this should apply to the other implementations, I don't have any of them installed to test at the moment though)
cheers,
Tom
Subject: | 2015-01-30-io-async-fileno.patch |
diff --git a/lib/Term/ReadLine/Event.pm b/lib/Term/ReadLine/Event.pm
index 96499a7..46a71e2 100644
--- a/lib/Term/ReadLine/Event.pm
+++ b/lib/Term/ReadLine/Event.pm
@@ -87,6 +87,13 @@ sub with_IO_Async {
# ensure we're referring to the same value, this is
# a SCALAR ref.
my $ready = \ do{my $dummy};
+ unless($fh->can('fileno')) {
+ require IO::Handle;
+ my $h = IO::Handle->new;
+ $h->fdopen($fh, 'r') or die "could not fdopen - $!";
+ $fh = $h
+ }
+
$self->{loop}->add(
$self->{watcher} =
IO::Async::Handle->new(