logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 8d6e9b25a416c0ccc551f94550071968cb76a09c
parent 5453038ce92597fe2d26cb843d48e9aa660d1ee9
Author: Mark Felder <feld@feld.me>
Date:   Thu, 14 Jan 2021 16:58:18 -0600

Just validate command is in PATH; forking a shell is wasteful

Diffstat:

Mlib/pleroma/utils.ex5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 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"