Miosa.Sandbox.Processes (Miosa v1.0.1)

Copy Markdown View Source

Background process management for a sandbox.

Wraps:

  • POST /sandboxes/:id/processes — start/4
  • GET /sandboxes/:id/processes — list/2
  • DELETE /sandboxes/:id/processes/:pid — kill/3
  • POST /sandboxes/:id/processes/:pid/stdin — send_stdin/4

Summary

Functions

Kill a background process by its PID (DELETE /sandboxes/:sandbox_id/processes/:pid).

List all running background processes in the sandbox (GET /sandboxes/:sandbox_id/processes).

Send data to the stdin of a running background process (POST /sandboxes/:sandbox_id/processes/:pid/stdin).

Start a background process in the sandbox (POST /sandboxes/:sandbox_id/processes).

Functions

kill(client, sandbox_id, pid)

@spec kill(Miosa.Client.t(), String.t(), String.t()) ::
  :ok | {:error, Miosa.Error.t()}

Kill a background process by its PID (DELETE /sandboxes/:sandbox_id/processes/:pid).

list(client, sandbox_id)

List all running background processes in the sandbox (GET /sandboxes/:sandbox_id/processes).

send_stdin(client, sandbox_id, pid, data)

@spec send_stdin(Miosa.Client.t(), String.t(), String.t(), String.t()) ::
  Miosa.Client.result(map())

Send data to the stdin of a running background process (POST /sandboxes/:sandbox_id/processes/:pid/stdin).

start(client, sandbox_id, command, opts \\ %{})

@spec start(Miosa.Client.t(), String.t(), String.t(), map()) ::
  Miosa.Client.result(map())

Start a background process in the sandbox (POST /sandboxes/:sandbox_id/processes).

Options map keys

  • "cwd" — Working directory for the process.
  • "env" — Environment variables map.
  • "timeout" — Process timeout in seconds.