# `Kettlecorn.Sandbox.Instance`
[🔗](https://github.com/mjrusso/kettlecorn/blob/v0.1.0/host/lib/kettlecorn/sandbox/instance.ex#L1)

One VM's private directory, and the launcher command line that runs the
VM on it.

`Kettlecorn.VM` prepares an instance from a `Kettlecorn.Sandbox`,
runs `command/1`, and calls `cleanup/1` after confirming launcher shutdown.
If shutdown cannot be confirmed, it retains the directory and logs an error.

# `t`

```elixir
@type t() :: %Kettlecorn.Sandbox.Instance{
  dir: Path.t(),
  sandbox: Kettlecorn.Sandbox.t()
}
```

# `cleanup`

```elixir
@spec cleanup(t()) :: :ok
```

Deletes the VM's private directory.

# `command`

```elixir
@spec command(t()) :: [String.t()]
```

The bundled launcher's executable and arguments for this instance.

# `prepare`

```elixir
@spec prepare(Kettlecorn.Sandbox.t()) :: t()
```

Creates the VM's private directory: a new directory with an unguessable
name, accessible only to this OS user, holding the guest's root (`root/`,
mounted at `/`) and, out of the guest's reach, the launcher's stderr. On
failure, removes what it created and raises.

# `stderr_file`

```elixir
@spec stderr_file(t()) :: Path.t()
```

The file the launcher's stderr goes to.

---

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