class Convoy::Formatter::ShellCommandExecutor
Attributes
command[R]
Public Class Methods
new(command)
click to toggle source
# File lib/convoy/formatter/shell_command_executor.rb, line 8 def initialize(command) @command = command end
Public Instance Methods
execute_in_current_shell(success_callback = nil, error_callback = nil)
click to toggle source
# File lib/convoy/formatter/shell_command_executor.rb, line 12 def execute_in_current_shell(success_callback = nil, error_callback = nil) begin result = `#{command}` process_status = $? raise Convoy::InternalError.new("Shell command exited with a non-zero (#{process_status.exitstatus}) exit code") if process_status.exitstatus != 0 success_callback.call(command, result) if success_callback rescue => e error_callback.call(command, e) if error_callback nil end end