mirror of
https://github.com/discourse/discourse.git
synced 2024-12-16 03:43:42 +08:00
21 lines
410 B
Ruby
21 lines
410 B
Ruby
require 'open3'
|
|
|
|
module BackupRestore
|
|
module Utils
|
|
def execute_command(*command, failure_message: "")
|
|
stdout, stderr, status = Open3.capture3(*command)
|
|
|
|
if !status.success?
|
|
failure_message = "#{failure_message}\n" if !failure_message.blank?
|
|
raise "#{failure_message}#{stderr}"
|
|
end
|
|
|
|
stdout
|
|
end
|
|
|
|
def pretty_logs(logs)
|
|
logs.join("\n")
|
|
end
|
|
end
|
|
end
|