busyloop / net-ssh-simple Goto Github PK
View Code? Open in Web Editor NEWA simple wrapper around Net::SSH and Net::SCP
Home Page: http://busyloop.github.com/net-ssh-simple/doc/frames.html
A simple wrapper around Net::SSH and Net::SCP
Home Page: http://busyloop.github.com/net-ssh-simple/doc/frames.html
Hello, thank you for library very much. What do think about supporting ionice options?
ref
https://www.systutorials.com/docs/linux/man/1-ionice/
ionice [-c class] [-n level] [-t] command [argument...]
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 :)
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.
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.
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
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>'
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.