PhoenixKitAgent.Attachments.Cmd (PhoenixKitAgent v0.1.0)

Copy Markdown View Source

Runs the external programs of attachment processing (pdfinfo, pdftotext, pdftoppm — poppler) with a time limit, and says plainly when one is not installed. What a program prints is never returned or logged on failure: it can quote the file.

Summary

Types

Why a program did not give its result.

Functions

Whether the program is installed.

Runs tool with args. {:ok, output} (stdout and stderr) when it exits with 0.

Types

failure()

@type failure() :: :tool_missing | :timeout | :failed

Why a program did not give its result.

Functions

available?(tool)

@spec available?(String.t()) :: boolean()

Whether the program is installed.

run(tool, args)

@spec run(String.t(), [String.t()]) :: {:ok, String.t()} | {:error, failure()}

Runs tool with args. {:ok, output} (stdout and stderr) when it exits with 0.