talira

erlexec

Execute and control OS processes from Erlang/OTP

open sourceBSD-3-Clausefree

erlexec is Serge Aleynikov's OS process manager for the Erlang VM: an Erlang application with a C++ port program that gives Erlang (and Elixir) processes fine-grained control over operating system processes. It starts and stops commands synchronously or asynchronously and reports their exit codes, signals and core dumps; sets a command's working directory, environment, process group, user and priority; links and monitors Erlang processes to OS processes so either ending ends the other; writes to a process's stdin and redirects stdout and stderr to files, Erlang processes or functions; runs interactive commands with a pseudo-terminal; uses Linux capabilities and cgroups; runs commands in Podman or Docker containers; and cleans up child processes when the port program exits.

Problems it solves

  • run and supervise an external command from Elixir or Erlang
  • stream a shell command's output into an Erlang process
  • make sure child OS processes die when my Erlang app stops

Features

  • start, stop and monitor OS processes with exit codes and signals
  • link Erlang processes to OS processes
  • stdin, stdout and stderr redirection to files, processes or functions
  • pseudo-terminal support for interactive commands
  • Linux capabilities, cgroups, and Podman or Docker containers
  • custom termination commands and kill timeouts