bastienleonard / hutte Goto Github PK
View Code? Open in Web Editor NEWSimple SSH execution in Ruby, heavily based on Python's Fabric
Home Page: https://bastienleonard.github.io/hutte
License: Other
Simple SSH execution in Ruby, heavily based on Python's Fabric
Home Page: https://bastienleonard.github.io/hutte
License: Other
Continued from issue #1:
now to figure out how to get the output of "run" commands into variables for processing.
thanks.
Update: scratch all that, use the object that is now returned by local()
and run()
: https://bastienleonard.github.io/hutte/reference/command_result.html
There isn't a public API for that, but I'll try to add it soon.
In the mean time, if you really need to capture the output of a command, you can use the internal API.
This will be a bit more complicated than necessary because the internal API uses callbacks, so that the output of long-running commands in shown in real time.
For remote commands (self
is a Dsl instance, if the block you passed to SshSession.run() takes a parameter, then pass it instead):
Hutte::ssh_exec(self.instance_variable_get('@session'), 'pwd') do |callback|
callback.on_stdout do |data|
puts data
end.on_stderr do |data|
puts data
end.on_exit_status_received do |status|
puts "Exit status: #{status}"
end
end
For local commands:
status = Hutte::LocalShell.run('pwd') do |callback|
callback.on_stdout do |data|
puts data
end.on_stderr do |data|
puts data
end
end
puts "Exit status: #{status}"
Note that you're on your own here, for example Hutte won't raise an error if the command fails (status != 0). Also error checking is minimal, your app will crash if a callback that wasn't supplied gets called.
Can hutte be made to use ~/.ssh/config so can specify name that is a "Host" in .ssh/config and it will use the full hostname, port, identityfile etc?
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.