diff options
author | Roman Chvanikov <chvanikoff@pm.me> | 2020-07-16 17:53:22 +0300 |
---|---|---|
committer | Roman Chvanikov <chvanikoff@pm.me> | 2020-07-16 17:53:22 +0300 |
commit | 9f92ccee60a08da3f6ebaf81250da1459bc0c24f (patch) | |
tree | 8f4abb40756d40b90c759b8cbdbeeebdfad7e937 /lib/pleroma/utils.ex | |
parent | 6d3b93b60aa911a51a8d7366ad4afac6238577c7 (diff) | |
download | pleroma-9f92ccee60a08da3f6ebaf81250da1459bc0c24f.tar.gz |
refactor frontend task
Diffstat (limited to 'lib/pleroma/utils.ex')
-rw-r--r-- | lib/pleroma/utils.ex | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/pleroma/utils.ex b/lib/pleroma/utils.ex index 21d1159be..fef9b6cc8 100644 --- a/lib/pleroma/utils.ex +++ b/lib/pleroma/utils.ex @@ -24,4 +24,18 @@ defmodule Pleroma.Utils do def command_available?(command) do match?({_output, 0}, System.cmd("sh", ["-c", "command -v #{command}"])) end + + @doc """ + Throws an exception in case required command is not available + """ + @spec command_required!(String.t()) :: :ok | no_return() + def command_required!(command) do + case command_available?(command) do + true -> + :ok + + false -> + raise "Command #{command} is required, but not available in $PATH" + end + end end |