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.
114 115 116 |
# File 'lib/train/transports/local.rb', line 114 def initialize(connection, ) @cmd_wrapper = Local::CommandWrapper.load(connection, ) end |
Instance Method Details
#close ⇒ Object
133 134 135 |
# File 'lib/train/transports/local.rb', line 133 def close # nothing to do at the moment end |
#run_command(cmd, opts = {}) ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/train/transports/local.rb', line 118 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 |