diff options
Diffstat (limited to 'lib/PublicInbox/LI2Wrap.pm')
-rw-r--r-- | lib/PublicInbox/LI2Wrap.pm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/PublicInbox/LI2Wrap.pm b/lib/PublicInbox/LI2Wrap.pm new file mode 100644 index 00000000..d4792b25 --- /dev/null +++ b/lib/PublicInbox/LI2Wrap.pm @@ -0,0 +1,20 @@ +# Copyright (C) all contributors <meta@public-inbox.org> +# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt> + +# Wrapper for Linux::Inotify2 < 2.3 which lacked ->fh and auto-close +# Remove this when supported LTS/enterprise distros are all +# Linux::Inotify2 >= 2.3 +package PublicInbox::LI2Wrap; +use v5.12; +our @ISA = qw(Linux::Inotify2); + +sub wrapclose { + my ($inot) = @_; + my $fd = $inot->fileno; + open my $fh, '<&=', $fd or die "open <&= $fd $!"; + bless $inot, __PACKAGE__; +} + +sub DESTROY {} # no-op + +1 |