View Source Stdio.Process (stdio v0.4.4)

Supervised system processes

fork(2) new system processes.

Privileges

No additional privileges required. If the Stdio supervisor process is running as root, supervised processes will by default drop to an unprivileged user.

Operations

See Stdio.config/0 for configuration options.

  • creates a new session

  • sets the process priority [:priority=0]

  • sets resource limits defined in the rlimit option [:rlimit=coredumps disabled]

  • sends the process a SIGKILL if the parent process exits

If the system process is running with root privileges:

  • sets additional groups as specified in the group option [:groups=additional groups removed]

  • drops privileges to the value of uid and gid or a high UID system [:uid/gid=65536-131071]

  • disables the ability of the process to escalate privileges [:setuid=false]

Warning

The generated UID/GID may overlap with existing users.

Examples

iex> Stdio.stream!(
...> "ping -q -c 1 127.0.0.1 | grep -o PING",
...> Stdio.Process,
...> setuid: true
...> ) |> Enum.to_list()
[stdout: "PING\n", exit_status: 0]

Summary

Functions

Test if a Stdio process is running

Signal a process by process group, falling back to PID

Functions

@spec alive?(:prx.task()) :: boolean()

Test if a Stdio process is running

Link to this function

signal(task, pid, signal)

View Source
@spec signal(:prx.task(), :prx.pid_t(), pos_integer() | atom()) ::
  :ok | {:error, :prx.posix()}

Signal a process by process group, falling back to PID