Method: ChildProcess::JRuby.posix_fileno_for
- Defined in:
- lib/childprocess/jruby.rb
.posix_fileno_for(obj) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/childprocess/jruby.rb', line 18 def self.posix_fileno_for(obj) channel = ::JRuby.reference(obj).channel begin channel.getFDVal rescue NoMethodError fileno = channel.fd if fileno.kind_of?(Java::JavaIo::FileDescriptor) fileno = fileno.fd end fileno == -1 ? obj.fileno : fileno end rescue # fall back obj.fileno end |