File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -3,13 +3,17 @@ package main
33import (
44 "errors"
55 "fmt"
6+ "net/http"
67 "os"
78 "runtime/debug"
89
10+ _ "net/http/pprof"
11+
912 "github.com/alecthomas/kong"
1013 tea "github.com/charmbracelet/bubbletea"
1114 "github.com/charmbracelet/gum/internal/exit"
1215 "github.com/charmbracelet/lipgloss"
16+ "github.com/charmbracelet/log"
1317 "github.com/muesli/termenv"
1418)
1519
@@ -30,6 +34,15 @@ var bubbleGumPink = lipgloss.NewStyle().Foreground(lipgloss.Color("212"))
3034func main () {
3135 lipgloss .SetColorProfile (termenv .NewOutput (os .Stderr ).Profile )
3236
37+ if os .Getenv ("GUM_DEBUG" ) != "" {
38+ go func () {
39+ log .Info ("serving pprof at localhost:6060" )
40+ if err := http .ListenAndServe ("localhost:6060" , nil ); err != nil {
41+ log .Error ("failed to pprof listen" , "err" , err )
42+ }
43+ }()
44+ }
45+
3346 if Version == "" {
3447 if info , ok := debug .ReadBuildInfo (); ok && info .Main .Sum != "" {
3548 Version = info .Main .Version
You can’t perform that action at this time.
0 commit comments