mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 03:41:12 +08:00
REFACTOR: Simplify git command execution
This commit is contained in:

committed by
Gerhard Schlager

parent
af58dbeb24
commit
f523dcf9df
@ -801,17 +801,11 @@ module Discourse
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.try_git(git_cmd, default_value)
|
def self.try_git(git_cmd, default_value)
|
||||||
version_value = false
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
version_value = `#{git_cmd}`.strip
|
`#{git_cmd}`.strip
|
||||||
rescue StandardError
|
rescue StandardError
|
||||||
version_value = default_value
|
default_value
|
||||||
end
|
end.presence || default_value
|
||||||
|
|
||||||
version_value = default_value if version_value.empty?
|
|
||||||
|
|
||||||
version_value
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Either returns the site_contact_username user or the first admin.
|
# Either returns the site_contact_username user or the first admin.
|
||||||
|
Reference in New Issue
Block a user