# `Excessibility.MCP.Subprocess`
[🔗](https://github.com/lessthanseventy/excessibility/blob/v0.18.1/lib/excessibility/mcp/subprocess.ex#L1)

Subprocess execution with proper timeout handling.

Unlike `System.cmd/3` wrapped in `Task.yield/shutdown`, this module
actually kills the underlying OS process when a timeout occurs.

# `run`

Runs a command with optional timeout.

## Options

  * `:timeout` - Timeout in milliseconds. If nil, no timeout is applied.
  * `:cd` - Working directory for the command.
  * `:env` - Environment variables as a list of `{key, value}` tuples.
  * `:stderr_to_stdout` - If true, redirects stderr to stdout (default: false).

## Returns

  * `{output, exit_code}` on success or timeout
  * On timeout, returns `{"Error: Command timed out after N seconds", 124}`

## Examples

    iex> Subprocess.run("echo", ["hello"], timeout: 5000)
    {"hello\n", 0}

    iex> Subprocess.run("sleep", ["10"], timeout: 100)
    {"Error: Command timed out after 0 seconds", 124}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
