mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 15:31:11 +08:00
DEV: Fix command error message formatting (#31491)
a follow up to 51b0903f514c3c22569401e74ebd1215c317d787
This commit is contained in:
@ -169,7 +169,7 @@ module Discourse
|
||||
stdout, stderr, status = Open3.capture3(*args, chdir: chdir)
|
||||
|
||||
if !status.exited? || !success_status_codes.include?(status.exitstatus)
|
||||
message = [command, failure_message, stderr].filter(&:present?).join("\n")
|
||||
message = [command.join(" "), failure_message, stderr].filter(&:present?).join("\n")
|
||||
raise CommandError.new(message, stdout: stdout, stderr: stderr, status: status)
|
||||
end
|
||||
|
||||
|
@ -553,8 +553,8 @@ RSpec.describe Discourse do
|
||||
|
||||
it "includes the command in the error message" do
|
||||
expect do
|
||||
Discourse::Utils.execute_command("false", failure_message: "oops")
|
||||
end.to raise_error(RuntimeError, "false\noops")
|
||||
Discourse::Utils.execute_command("false", "'foo'", failure_message: "oops")
|
||||
end.to raise_error(RuntimeError, "false 'foo'\noops")
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user