diff options
author | Angelina Filippova <linakirsanova@gmail.com> | 2020-08-07 21:05:44 +0300 |
---|---|---|
committer | Angelina Filippova <linakirsanova@gmail.com> | 2020-08-07 21:05:44 +0300 |
commit | f21b6ebd5d71b77b1f2b7c8918005c3b70752c15 (patch) | |
tree | 7beddc568e0e1430ab6bc8fdbc4c6d9d04744d49 /lib/pleroma/utils.ex | |
parent | 8e1f7a3eff05a43f59f15dc6fa0483713e221fa7 (diff) | |
parent | 8e90cc58e7ec3f19f03d049ff541750f1ab4774e (diff) | |
download | pleroma-f21b6ebd5d71b77b1f2b7c8918005c3b70752c15.tar.gz |
Merge branch 'feature/update-welcome-setting-in-description' of git.pleroma.social:pleroma/pleroma into feature/update-welcome-setting-in-description
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 |