1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Utils do
6 def compile_dir(dir) when is_binary(dir) do
9 |> Enum.map(&Path.join(dir, &1))
10 |> Kernel.ParallelCompiler.compile()
14 POSIX-compliant check if command is available in the system
17 iex> command_available?("git")
19 iex> command_available?("wrongcmd")
23 @spec command_available?(String.t()) :: boolean()
24 def command_available?(command) do
25 match?({_output, 0}, System.cmd("sh", ["-c", "command -v #{command}"]))