Merge branch 'optimize-command_available' into 'develop'
Optimize Pleroma.Utils.command_available?/1 See merge request pleroma/pleroma!3254
This commit is contained in:
commit
cf367fdbd5
1 changed files with 4 additions and 1 deletions
|
@ -30,7 +30,10 @@ def compile_dir(dir) when is_binary(dir) do
|
|||
"""
|
||||
@spec command_available?(String.t()) :: boolean()
|
||||
def command_available?(command) do
|
||||
match?({_output, 0}, System.cmd("sh", ["-c", "command -v #{command}"]))
|
||||
case :os.find_executable(String.to_charlist(command)) do
|
||||
false -> false
|
||||
_ -> true
|
||||
end
|
||||
end
|
||||
|
||||
@doc "creates the uniq temporary directory"
|
||||
|
|
Loading…
Reference in a new issue