1package main
 2
 3import (
 4	"net/http"
 5	"os"
 6
 7	_ "net/http/pprof" // profiling
 8
 9	"github.com/charmbracelet/crush/cmd"
10	"github.com/charmbracelet/crush/internal/logging"
11)
12
13func main() {
14	defer logging.RecoverPanic("main", func() {
15		logging.ErrorPersist("Application terminated due to unhandled panic")
16	})
17
18	if os.Getenv("CRUSH_PROFILE") != "" {
19		go func() {
20			logging.Info("Serving pprof at localhost:6060")
21			if httpErr := http.ListenAndServe("localhost:6060", nil); httpErr != nil {
22				logging.Error("Failed to pprof listen: %v", httpErr)
23			}
24		}()
25	}
26
27	cmd.Execute()
28}