Class: SSHKit::Backend::Local
- Defined in:
- lib/sshkit/backends/local.rb
Instance Attribute Summary
Attributes inherited from Abstract
Instance Method Summary collapse
- #execute(*args) ⇒ Object
-
#initialize(&block) ⇒ Local
constructor
A new instance of Local.
- #run ⇒ Object
Methods inherited from Printer
Methods included from CommandHelper
Methods inherited from Abstract
#as, #background, #capture, config, configure, #debug, #error, #fatal, #info, #log, #make, #rake, #test, #trace, #warn, #with, #within
Constructor Details
#initialize(&block) ⇒ Local
Returns a new instance of Local.
8 9 10 |
# File 'lib/sshkit/backends/local.rb', line 8 def initialize(&block) @block = block end |
Instance Method Details
#execute(*args) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/sshkit/backends/local.rb', line 16 def execute(*args) command(*args).tap do |cmd| output << cmd cmd.started = Time.now stdout, stderr, exit_status = Open3.capture3(cmd.to_command) cmd.stdout = stdout cmd.full_stdout += stdout cmd.stderr = stderr cmd.full_stderr += stderr cmd.exit_status = exit_status.to_i output << cmd end end |
#run ⇒ Object
12 13 14 |
# File 'lib/sshkit/backends/local.rb', line 12 def run instance_exec(&@block) end |