Skip to content

Instantly share code, notes, and snippets.

@seancribbs
Forked from headius/gist:1430947
Created December 4, 2011 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seancribbs/1430966 to your computer and use it in GitHub Desktop.
Save seancribbs/1430966 to your computer and use it in GitHub Desktop.
require 'ffi'
require 'jnr-enxio-0.1.jar'
module Open
extend FFI::Library
ffi_lib 'c'
attach_function :open, [:string, :int], :int
end
fd = Open.open('fifo', File::RDONLY | File::NONBLOCK)
channel = Java::jnr.enxio.channels.NativeDeviceChannel.new(fd)
io = channel.to_io
puts io.gets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment