Class: Net::SSH::Compat
- Inherits:
-
Object
- Object
- Net::SSH::Compat
- Defined in:
- lib/net/ssh/ruby_compat.rb
Overview
This class contains miscellaneous patches and workarounds for different ruby implementations.
Constant Summary collapse
- SELECT_MUTEX =
Mutex.new
Class Method Summary collapse
-
.io_select(*params) ⇒ Object
problem: Pageant sockets aren’t real sockets/don’t inherit from IO, so we can’t call IO.select on them solution: when a Pageant socket is found in the readers/writers array, slice it out then merge it back in before returning (just assume it’s always ready) unfortunately this fix will also need to be ported to any other library that reaches in to Net::SSH and select’s its sockets (like Capistrano) this is slightly more verbose than necessary, but it’s useful for debugging.
Class Method Details
.io_select(*params) ⇒ Object
problem: Pageant sockets aren’t real sockets/don’t inherit from IO, so we can’t call IO.select on them solution: when a Pageant socket is found in the readers/writers array, slice it out then merge it back in before returning (just assume it’s always ready) unfortunately this fix will also need to be ported to any other library that reaches in to Net::SSH and select’s its sockets (like Capistrano) this is slightly more verbose than necessary, but it’s useful for debugging
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/net/ssh/ruby_compat.rb', line 34 def self.io_select(*params) read_array = params[0] write_array = params[1] error_array = params[2] timeout = params[3] read_sockets = read_array.nil? ? [] : read_array.reject {|s| s.class.name =~ /Pageant/ } read_pageant = read_array.nil? ? [] : read_array.select {|s| s.class.name =~ /Pageant/ } write_sockets = write_array.nil? ? [] : write_array.reject {|s| s.class.name =~ /Pageant/ } write_pageant = write_array.nil? ? [] : write_array.select {|s| s.class.name =~ /Pageant/ } result = IO.select(read_sockets, write_sockets, error_array, timeout) if result.nil? return nil else ready_read_sockets = result[0] ready_write_sockets = result[1] ready_error_array_only_sockets = result[2] return [ready_read_sockets | read_pageant, ready_write_sockets | write_pageant, ready_error_array_only_sockets] end end |