mirror of
https://git.youjo.love/youjo/youjo-be.git
synced 2024-11-20 05:49:54 +01:00
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 @@ 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 a new issue