Module: Asgit::Shell
- Defined in:
- lib/asgit/shell.rb
Class Method Summary collapse
Class Method Details
.run(command, &block) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/asgit/shell.rb', line 8 def run command, &block stdout, stderr, status = Open3.capture3(command) if status.success? yield stdout if block_given? [ true, stdout, stderr ] else $stderr.puts "Problem running #{command}" $stderr.puts stderr [ false, stdout, stderr ] end rescue StandardError => e $stderr.puts "Problem running '#{command}'" $stderr.puts "#{e.}" $stderr.puts "#{e.backtrace}" end |