Just validate command is in PATH; forking a shell is wasteful
This commit is contained in:
parent
5453038ce9
commit
8d6e9b25a4
|
@ -30,7 +30,10 @@ def compile_dir(dir) when is_binary(dir) do
|
||||||
"""
|
"""
|
||||||
@spec command_available?(String.t()) :: boolean()
|
@spec command_available?(String.t()) :: boolean()
|
||||||
def command_available?(command) do
|
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
|
end
|
||||||
|
|
||||||
@doc "creates the uniq temporary directory"
|
@doc "creates the uniq temporary directory"
|
||||||
|
|
Loading…
Reference in New Issue