diff options
author | Mark Felder <feld@feld.me> | 2021-01-14 16:58:18 -0600 |
---|---|---|
committer | Mark Felder <feld@feld.me> | 2021-01-14 17:19:02 -0600 |
commit | 8d6e9b25a416c0ccc551f94550071968cb76a09c (patch) | |
tree | c2540b1bdc62e15f6e151d8cafd8a2277dfcf43e | |
parent | 5453038ce92597fe2d26cb843d48e9aa660d1ee9 (diff) | |
download | pleroma-8d6e9b25a416c0ccc551f94550071968cb76a09c.tar.gz |
Just validate command is in PATH; forking a shell is wasteful
-rw-r--r-- | lib/pleroma/utils.ex | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/pleroma/utils.ex b/lib/pleroma/utils.ex index fa75a8c99..fae7657d9 100644 --- a/lib/pleroma/utils.ex +++ b/lib/pleroma/utils.ex @@ -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" |