mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-04 21:01:27 -05:00
20 lines
410 B
Ruby
20 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
|