Method: VMC::Micro.run_command
- Defined in:
- lib/vmc/micro.rb
.run_command(command, args = nil) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/vmc/micro.rb', line 37 def run_command(command, args=nil) # TODO switch to using posix-spawn instead result = %x{#{command} #{args} 2>&1} unless $?.exitstatus == 0 if block_given? yield else raise "failed to execute #{command} #{args}:\n#{result}" end else result.split(/\n/) end end |