Code Monkey home page Code Monkey logo

net-ssh-simple's People

Contributors

arie avatar m-o-e avatar mzahir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

net-ssh-simple's Issues

Is streaming output supported?

I was using Net::SSH before but I have a hard time streaming the output, example I'm doing a apt-get install package, I want to stream the output, not show it after the process is done. Do you have a wrapper for it, maybe I haven't looked at the docs well :)

Maximum timeout too large for 32 bit systems.

The offending line is around line 631 of simple.rb

def with_session(host, opts={}, &block)
    opts[:timeout] ||= 60
    opts[:timeout] = 2**32 if opts[:timeout] == 0
    opts[:operation_timeout] ||= 3600
    opts[:operation_timeout] = 2**32 if opts[:operation_timeout] == 0

2^32 is too big to store in a long on a 32 bit system, instead you need 2^16 or smaller. Unfortunately this is less then a day, so perhaps a better fix is in order.

Without this fix you get
"Net::SSH:Simple::Error: bignum too big to convert into 'long'" Which is itself a RangeError.

If you'd like I can submit a pull request with a patch.

RangeError exception thrown when connecting without timeout on 32bit machine

I'm experiencing an error when trying to connect on a 32bit machine with the latest net-ssh-simple. It seems that the new 32bit check doesn't work properly with my setup.

Possibly relevant information

Debian 7.10
Linux 3.2.0-4-686-pae (32bit)
Ruby v2.3.3
Net-ssh-simple v1.7.0
Net-ssh v4.1.0

Example of error

irb(main):001:0> require 'socket'; Socket.tcp('127.0.0.1', 1, connect_timeout: 2**32).close
RangeError: bignum too big to convert into `long'
	from /home/promote/.rbenv/versions/2.3.3/lib/ruby/2.3.0/socket.rb:60:in `wait_writable'
	from /home/promote/.rbenv/versions/2.3.3/lib/ruby/2.3.0/socket.rb:60:in `connect_internal'
	from /home/promote/.rbenv/versions/2.3.3/lib/ruby/2.3.0/socket.rb:139:in `connect'
	from /home/promote/.rbenv/versions/2.3.3/lib/ruby/2.3.0/socket.rb:636:in `block in tcp'
	from /home/promote/.rbenv/versions/2.3.3/lib/ruby/2.3.0/socket.rb:231:in `each'
	from /home/promote/.rbenv/versions/2.3.3/lib/ruby/2.3.0/socket.rb:231:in `foreach'
	from /home/promote/.rbenv/versions/2.3.3/lib/ruby/2.3.0/socket.rb:626:in `tcp'
	from (irb):1
	from /home/promote/.rbenv/versions/2.3.3/bin/irb:11:in `<main>'

Naive solution

I solved it temporarily with this fix, but it doesn't quite seem like the right solution to me.

diff --git a/lib/net/ssh/simple.rb b/lib/net/ssh/simple.rb
index f9263e6..42dca56 100755
--- a/lib/net/ssh/simple.rb
+++ b/lib/net/ssh/simple.rb
@@ -602,7 +602,7 @@ module Net
       is_64bit_platform = true
       begin
         Socket.tcp('127.0.0.1', 1, connect_timeout: 2**32).close
-      rescue Errno::EINVAL
+      rescue Errno::EINVAL, RangeError
         is_64bit_platform = false
       rescue
       end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.