about summary refs log tree commit homepage
path: root/bin
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-01-23 21:00:27 +0000
committerEric Wong <e@80x24.org>2022-01-23 21:03:50 +0000
commiteab2f44b4d02ee5e468a41d50275b6506adf83d6 (patch)
treec91064cc33cd441ffea8b133b8f91107aac536dc /bin
parent7c433348820908fbf4d723ec1cff605ae5ea06a8 (diff)
downloaddtas-eab2f44b4d02ee5e468a41d50275b6506adf83d6.tar.gz
Since Ruby 2.3, it no longer checks FIONREAD, and we require
Ruby 2.3+ nowadays, so drop our IO.select-based workarounds.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/dtas-readahead16
1 files changed, 2 insertions, 14 deletions
diff --git a/bin/dtas-readahead b/bin/dtas-readahead
index d3c6e79..75bfbe8 100755
--- a/bin/dtas-readahead
+++ b/bin/dtas-readahead
@@ -28,18 +28,6 @@ null = DTAS.null
 @redir = { err: null, out: null, in: null }.freeze
 require 'pp'
 
-if RUBY_VERSION.to_r >= '2.3'.to_r
-  # Old Rubies did FIONREAD, which breaks on SOCK_SEQPACKET
-  def wait_read(w, timeout)
-    w.to_io.wait_readable(timeout)
-  end
-else
-  def wait_read(w, timeout)
-    r = IO.select([w], nil, nil, timeout)
-    r ? r[0] : nil
-  end
-end
-
 def seek_to_cur_pos(cur_pid, fp)
   cur_fd = []
   fpst = fp.stat
@@ -120,7 +108,7 @@ def do_ra(fp, pos, w)
     len -= n
 
     # stop reading immediately if there's an event
-    if wait_read(w, 0)
+    if w.to_io.wait_readable(0)
       adj = @todo_ra
       pos += size
       break
@@ -220,7 +208,7 @@ begin
     fp.close if fp && !fp.closed?
     fp = timeout = nil
   end
-  r = wait_read(w, timeout)
+  r = w.to_io.wait_readable(timeout)
   p w.res_wait if r
 rescue EOFError
   abort "dtas-player exited"