mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
DEV: Add command to execute_command
errors (#31490)
This commit is contained in:
@ -169,13 +169,8 @@ module Discourse
|
|||||||
stdout, stderr, status = Open3.capture3(*args, chdir: chdir)
|
stdout, stderr, status = Open3.capture3(*args, chdir: chdir)
|
||||||
|
|
||||||
if !status.exited? || !success_status_codes.include?(status.exitstatus)
|
if !status.exited? || !success_status_codes.include?(status.exitstatus)
|
||||||
failure_message = "#{failure_message}\n" if !failure_message.blank?
|
message = [command, failure_message, stderr].filter(&:present?).join("\n")
|
||||||
raise CommandError.new(
|
raise CommandError.new(message, stdout: stdout, stderr: stderr, status: status)
|
||||||
"#{caller[0]}: #{failure_message}#{stderr}",
|
|
||||||
stdout: stdout,
|
|
||||||
stderr: stderr,
|
|
||||||
status: status,
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
stdout
|
stdout
|
||||||
|
@ -550,6 +550,12 @@ RSpec.describe Discourse do
|
|||||||
"a b c",
|
"a b c",
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe ".clear_all_theme_cache!" do
|
describe ".clear_all_theme_cache!" do
|
||||||
|
Reference in New Issue
Block a user