Module: ChildProcess::JRuby
- Defined in:
- lib/childprocess/jruby/io.rb,
lib/childprocess/jruby/pump.rb,
lib/childprocess/jruby/process.rb,
lib/childprocess/jruby.rb
Defined Under Namespace
Classes: IO, Process, Pump
Class Method Summary
collapse
Class Method Details
.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
obj.fileno
end
|
.windows_handle_for(obj) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/childprocess/jruby.rb', line 35
def self.windows_handle_for(obj)
channel = ::JRuby.reference(obj).channel
fileno = obj.fileno
begin
fileno = channel.getFDVal
rescue NoMethodError
fileno = channel.fd if channel.respond_to?(:fd)
end
if fileno.kind_of? Java::JavaIo::FileDescriptor
fileno.handle
else
Windows::Lib.handle_for fileno
end
end
|