class ToolExecutorHelper
Helper functions for the tool executor
Public Instance Methods
Source
# File lib/ceedling/tool_executor_helper.rb, line 65 def log_results(command_str, shell_result) # No logging unless we're at least at Obnoxious return if !@verbosinator.should_output?( Verbosity::OBNOXIOUS ) output = "> Shell executed command:\n" output += "`#{command_str}`\n" if !shell_result.empty? # Detailed debug logging if @verbosinator.should_output?( Verbosity::DEBUG ) output += "> With $stdout: " output += shell_result[:stdout].empty? ? "<empty>\n" : "\n#{shell_result[:stdout].strip()}\n" output += "> With $stderr: " output += shell_result[:stderr].empty? ? "<empty>\n" : "\n#{shell_result[:stderr].strip()}\n" output += "> And terminated with status: #{shell_result[:status]}\n" @loginator.log( '', Verbosity::DEBUG ) @loginator.log( output, Verbosity::DEBUG ) @loginator.log( '', Verbosity::DEBUG ) return # Bail out end # Slightly less verbose obnoxious logging if !shell_result[:output].empty? output += "> Produced output: " output += shell_result[:output].strip().empty? ? "<empty>\n" : "\n#{shell_result[:output].strip()}\n" end if !shell_result[:exit_code].nil? output += "> And terminated with exit code: [#{shell_result[:exit_code]}]\n" else output += "> And exited prematurely\n" end end @loginator.log( '', Verbosity::OBNOXIOUS ) @loginator.log( output, Verbosity::OBNOXIOUS ) @loginator.log( '', Verbosity::OBNOXIOUS ) end
Logs tool execution results
Attributes¶ ↑
-
command_str: The command ran.
-
shell_results: The outputs of the command including exit code and output.
Source
Source
# File lib/ceedling/tool_executor_helper.rb, line 33 def stderr_redirect_cmdline_append(tool_config) return nil if (tool_config.nil? || tool_config[:stderr_redirect].nil?) config_redirect = tool_config[:stderr_redirect] redirect = StdErrRedirect::NONE if (config_redirect == StdErrRedirect::AUTO) if (@system_wrapper.windows?) redirect = StdErrRedirect::WIN elsif (@system_utils.tcsh_shell?) redirect = StdErrRedirect::TCSH else redirect = StdErrRedirect::UNIX end end case redirect when StdErrRedirect::NONE then nil when StdErrRedirect::WIN then '2>&1' when StdErrRedirect::UNIX then '2>&1' when StdErrRedirect::TCSH then '|&' else redirect.to_s end end
Returns the stderr redirect append based on the config.
Attributes¶ ↑
-
tool_config: A hash containing config information.