Clarify failed command error message indicating to run -F - close #133

This commit is contained in:
Josh Holtrop 2021-11-15 21:45:18 -05:00
parent ca747232cd
commit 0face546e3
3 changed files with 10 additions and 2 deletions

View File

@ -286,7 +286,7 @@ module Rscons
unless @process_failures.empty? unless @process_failures.empty?
msg = @process_failures.join("\n") msg = @process_failures.join("\n")
if Cache.instance["failed_commands"].size > 0 if Cache.instance["failed_commands"].size > 0
msg += "\nUse -F to view the failed command log from the previous build operation" msg += "\nUse `#{Util.command_to_execute_me} -F` to view the failed command log from the previous build operation"
end end
raise RsconsError.new(msg) raise RsconsError.new(msg)
end end

View File

@ -217,6 +217,14 @@ module Rscons
queue.pop queue.pop
end end
# Command that can be run to execute this instance of rscons from the
# current working directory.
def command_to_execute_me
command = Pathname.new(File.expand_path($0)).relative_path_from(Dir.pwd).to_s
command = "./#{command}" unless command["/"]
command
end
private private
# Check if a directory contains a certain executable. # Check if a directory contains a certain executable.

View File

@ -1066,7 +1066,7 @@ EOF
result = run_rscons result = run_rscons
expect(result.stderr).to match /Failed to build/ expect(result.stderr).to match /Failed to build/
expect(result.stderr).to match /^Use.*-F.*to view the failed command log/ expect(result.stderr).to match %r{^Use .*/rscons(\.rb)? -F.*to view the failed command log}
expect(result.status).to_not eq 0 expect(result.status).to_not eq 0
result = run_rscons(rscons_args: %w[-F]) result = run_rscons(rscons_args: %w[-F])