main_test.go

 1package view
 2
 3import (
 4	"os"
 5	"testing"
 6
 7	"github.com/floatpane/termimage"
 8)
 9
10// TestMain intercepts subprocess invocations made by termimage's sandbox
11// worker (TERMIMAGE_WORKER=1). Without this, a test binary spawned as a
12// worker would re-run the full test suite, which itself triggers more
13// workers — a fork bomb that exhausts RAM and freezes the machine.
14// Mirrors the call in main.go's main().
15func TestMain(m *testing.M) {
16	termimage.MaybeRunWorker()
17	os.Exit(m.Run())
18}