# `Raxol.Journal.Test.ForeignBeam`
[🔗](https://github.com/DROOdotFOO/raxol/blob/v2.8.0/lib/raxol/journal/test/foreign_beam.ex#L1)

A second BEAM OS process with every application built beside
`raxol_journal` on its path, for tests of the journal's cross-process writer
lock: a holder that is really another BEAM.

It lives until its port closes (it reads its stdin to the end), so it ends
with the test process that started it. `start_supervised/2` also kills it
when the test exits, which covers a BEAM stuck before it reads.

For ExUnit suites: `start_supervised/2` registers an `on_exit` callback, so
it is called from a test process. Nothing else in this package calls this
module.

# `t`

```elixir
@type t() :: %{port: port(), pid: String.t()}
```

# `dead_pid`

```elixir
@spec dead_pid() :: String.t()
```

The OS pid of a process that has exited and been reaped.

# `go`

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

Let a BEAM started with `on_go` run it.

# `kill`

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

Kill the BEAM (SIGKILL, so nothing it holds is released) and wait for its exit.

# `lines_until`

The lines the BEAM printed, up to and excluding the line `last`.

# `signal`

```elixir
@spec signal(%{pid: String.t()}) :: :ok
```

SIGKILL without waiting, for a process that does not own the port (`on_exit`).

# `start`

```elixir
@spec start(String.t(), String.t() | nil) :: t()
```

Start a BEAM that evaluates `setup` (Elixir source) and then waits. Returns
once `setup` has run; `pid` is its OS pid. With `on_go` (Elixir source) it
evaluates that when `go/1` is called; what `on_go` prints, a line at a time,
is read with `lines_until/2`.

# `start_supervised`

```elixir
@spec start_supervised(String.t(), String.t() | nil) :: t()
```

`start/2`, and the BEAM is killed when the calling test exits.

---

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