about summary refs log tree commit homepage
path: root/lib/dtas/buffer.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-12-20 01:39:15 +0000
committerEric Wong <e@80x24.org>2020-01-06 08:15:15 +0000
commit01fec98a75a6c879c96b3c757557559b9bd18a19 (patch)
treee43df1eef9730e2fb50be264550af9e104d22782 /lib/dtas/buffer.rb
parent940c0b3cffa7f691620e7890ada15c7519817307 (diff)
downloaddtas-01fec98a75a6c879c96b3c757557559b9bd18a19.tar.gz
Fiddle exists on all Ruby 1.9.2+ installations and seems
alright.  Since splice is a Linux-only API, we don't need to
worry about the values of constants changing (and they're
architecture-independent).
Diffstat (limited to 'lib/dtas/buffer.rb')
-rw-r--r--lib/dtas/buffer.rb15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/dtas/buffer.rb b/lib/dtas/buffer.rb
index 39070d7..e0919d4 100644
--- a/lib/dtas/buffer.rb
+++ b/lib/dtas/buffer.rb
@@ -8,12 +8,15 @@ require_relative '../dtas'
 class DTAS::Buffer # :nodoc:
   begin
     raise LoadError, "no splice with _DTAS_POSIX" if ENV["_DTAS_POSIX"]
-    require 'sleepy_penguin' # splice is only in Linux for now...
-    SleepyPenguin.respond_to?(:splice) or
-      raise LoadError, 'sleepy_penguin 3.5+ required for splice', []
-    require_relative 'buffer/splice'
-    include DTAS::Buffer::Splice
-  rescue LoadError
+    # splice is only in Linux for now
+    begin
+      require_relative 'buffer/splice'
+      include DTAS::Buffer::Splice
+    rescue LoadError
+      require_relative 'buffer/fiddle_splice'
+      include DTAS::Buffer::FiddleSplice
+    end
+  rescue LoadError, StandardError
     require_relative 'buffer/read_write'
     include DTAS::Buffer::ReadWrite
   end