Kettlecorn.Sandbox.Instance (kettlecorn v0.1.0)

Copy Markdown View Source

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.

Summary

Functions

Deletes the VM's private directory.

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

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.

The file the launcher's stderr goes to.

Types

t()

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

Functions

cleanup(instance)

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

Deletes the VM's private directory.

command(instance)

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

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

prepare(s)

@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(instance)

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

The file the launcher's stderr goes to.