Vibe.Command (vibe v0.2.0)

Copy Markdown View Source

Supervised OS command execution for eval sessions and agents.

Commands run under Vibe's command supervisor instead of as untracked shell calls. Use run/2 for bounded synchronous commands and start/2 for long running jobs whose status, output, and cancellation should remain inspectable.

Eval sessions alias this module as Cmd. Prefer Cmd.run/2 and Cmd.start/2 over raw System.cmd/3 so command output can stream into the UI and cleanup is tied to Vibe's supervised runtime.

Summary

Functions

await(pid, timeout)

@spec await(Vibe.Command.Job.t() | pid(), timeout()) ::
  Vibe.Command.Result.t() | {:error, term()}

cancel(pid)

@spec cancel(Vibe.Command.Job.t() | pid()) ::
  Vibe.Command.Result.t() | {:error, term()}

output(job_or_pid, opts \\ [])

@spec output(
  Vibe.Command.Job.t() | pid(),
  keyword()
) :: String.t() | {:error, term()}

run(argv, opts \\ [])

@spec run(
  [String.Chars.t()],
  keyword()
) :: Vibe.Command.Result.t() | {:error, term()}

start(argv, opts \\ [])

@spec start(
  [String.Chars.t()],
  keyword()
) :: {:ok, Vibe.Command.Job.t()} | {:error, term()}

status(pid)

@spec status(Vibe.Command.Job.t() | pid()) ::
  Vibe.Command.Result.t() | {:error, term()}