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
@ -30,7 +30,10 @@ defmodule Pleroma.Utils 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 New Issue
Block a user