Module: Thrust::Executor
- Defined in:
- lib/thrust/executor.rb
Class Method Summary collapse
- .capture_output_from_system(cmd) ⇒ Object
- .check_command_for_failure(cmd) ⇒ Object
- .system(cmd, output_file = nil) ⇒ Object
- .system_or_exit(cmd, output_file = nil) ⇒ Object
Class Method Details
.capture_output_from_system(cmd) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/thrust/executor.rb', line 12 def self.capture_output_from_system(cmd) captured_output = `#{cmd}` raise '******** Build failed ********' if $?.exitstatus > 0 captured_output end |
.check_command_for_failure(cmd) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/thrust/executor.rb', line 19 def self.check_command_for_failure(cmd) STDERR.puts "Executing #{cmd} and checking for FAILURE" result = %x[#{cmd} 2>&1] STDERR.puts "Results:" STDERR.puts result result.include?("Finished") && !result.include?("FAILURE") && !result.include?("EXCEPTION") end |
.system(cmd, output_file = nil) ⇒ Object
6 7 8 9 10 |
# File 'lib/thrust/executor.rb', line 6 def self.system(cmd, output_file = nil) STDERR.puts "Executing #{cmd}" cmd += " > #{output_file}" if output_file Kernel::system(cmd) end |
.system_or_exit(cmd, output_file = nil) ⇒ Object
2 3 4 |
# File 'lib/thrust/executor.rb', line 2 def self.system_or_exit(cmd, output_file = nil) self.system(cmd, output_file) or raise '******** Build failed ********' end |