class Git::CommandLine
def process_result(result, normalize, chomp, timeout)
- Api: - private
Raises:
-
(Git::ProcessIOError)
- if an exception was raised while collecting subprocess output -
(Git::TimeoutError)
- if the command times out -
(Git::SignaledError)
- if the command was signaled -
(Git::FailedError)
- if the command failed
Returns:
-
(Git::CommandLineResult)
- the result of the command to return to the caller
Parameters:
-
timeout
(Numeric, nil
) -- the maximum seconds to wait for the command to complete -
chomp
(Boolean
) -- whether to chomp the output of each writer -
normalize
(Boolean
) -- whether to normalize the output of each writer -
result
(ProcessExecuter::Command::Result
) -- the result it is a Process::Status and include command, stdout, and stderr
def process_result(result, normalize, chomp, timeout) command = result.command processed_out, processed_err = post_process_all([result.stdout, result.stderr], normalize, chomp) logger.info { "#{command} exited with status #{result}" } logger.debug { "stdout:\n#{processed_out.inspect}\nstderr:\n#{processed_err.inspect}" } Git::CommandLineResult.new(command, result, processed_out, processed_err).tap do |processed_result| raise Git::TimeoutError.new(processed_result, timeout) if result.timeout? raise Git::SignaledError.new(processed_result) if result.signaled? raise Git::FailedError.new(processed_result) unless result.success? end end