diff options
author | lain <lain@soykaf.club> | 2020-08-06 15:22:20 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-08-06 15:22:20 +0200 |
commit | bf95dfb240cff8c5a2f8a0930e5309a09ca00ba1 (patch) | |
tree | 3a0c81155e7ae38e27008a7c066e8bc03fb1b410 /lib/pleroma/utils.ex | |
parent | 532d6f94aea5d4f53e846b8b77296f80a9ae68a0 (diff) | |
parent | 10b0e55acffeeff5842421c12b3b26feb35336de (diff) | |
download | pleroma-bf95dfb240cff8c5a2f8a0930e5309a09ca00ba1.tar.gz |
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into frontend-bundles-downloads
Diffstat (limited to 'lib/pleroma/utils.ex')
-rw-r--r-- | lib/pleroma/utils.ex | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/pleroma/utils.ex b/lib/pleroma/utils.ex index 6b8e3accf..21d1159be 100644 --- a/lib/pleroma/utils.ex +++ b/lib/pleroma/utils.ex @@ -9,4 +9,19 @@ defmodule Pleroma.Utils do |> Enum.map(&Path.join(dir, &1)) |> Kernel.ParallelCompiler.compile() end + + @doc """ + POSIX-compliant check if command is available in the system + + ## Examples + iex> command_available?("git") + true + iex> command_available?("wrongcmd") + false + + """ + @spec command_available?(String.t()) :: boolean() + def command_available?(command) do + match?({_output, 0}, System.cmd("sh", ["-c", "command -v #{command}"])) + end end |