Class: Train::Transports::Local::Connection::GenericRunner
- Inherits:
-
Object
- Object
- Train::Transports::Local::Connection::GenericRunner
- Defined in:
- lib/train/transports/local.rb
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(connection, options) ⇒ GenericRunner
constructor
A new instance of GenericRunner.
- #run_command(cmd, opts = {}) ⇒ Object
Constructor Details
#initialize(connection, options) ⇒ GenericRunner
Returns a new instance of GenericRunner.
115 116 117 |
# File 'lib/train/transports/local.rb', line 115 def initialize(connection, ) @cmd_wrapper = Local::CommandWrapper.load(connection, ) end |
Instance Method Details
#close ⇒ Object
134 135 136 |
# File 'lib/train/transports/local.rb', line 134 def close # nothing to do at the moment end |
#run_command(cmd, opts = {}) ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/train/transports/local.rb', line 119 def run_command(cmd, opts = {}) if defined?(@cmd_wrapper) && !@cmd_wrapper.nil? cmd = @cmd_wrapper.run(cmd) end res = Mixlib::ShellOut.new(cmd) res.timeout = opts[:timeout] begin res.run_command rescue Mixlib::ShellOut::CommandTimeout raise Train::CommandTimeoutReached end Local::CommandResult.new(res.stdout, res.stderr, res.exitstatus) end |