Add more tests to upload filters
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
25
lib/mobilizon/utils.ex
Normal file
25
lib/mobilizon/utils.ex
Normal file
@@ -0,0 +1,25 @@
|
||||
# Portions of this file are derived from Pleroma:
|
||||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Mobilizon.Utils do
|
||||
@moduledoc """
|
||||
Module that provide generic utils functions for Mobilizon
|
||||
"""
|
||||
|
||||
@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
|
||||
Reference in New Issue
Block a user