Remove panicparse
This commit is contained in:
parent
007ca2123b
commit
502db632d5
2
.gitignore
vendored
2
.gitignore
vendored
@ -24,3 +24,5 @@ _testmain.go
|
||||
*.prof
|
||||
.DS_Store
|
||||
/vendor
|
||||
.vscode/
|
||||
.mypy_cache/
|
||||
|
9
Gopkg.lock
generated
9
Gopkg.lock
generated
@ -9,14 +9,6 @@
|
||||
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:2eeeebccad4f052e6037527e86b8114c6bfd184a97f84d4449a5ea6ad202c216"
|
||||
name = "github.com/maruel/panicparse"
|
||||
packages = ["stack"]
|
||||
pruneopts = "UT"
|
||||
revision = "4417700b5a8d33fbb4416bb04359d20329f60008"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:e2d1d410fb367567c2b53ed9e2d719d3c1f0891397bb2fa49afd747cfbf1e8e4"
|
||||
name = "github.com/mattn/go-runewidth"
|
||||
@ -70,7 +62,6 @@
|
||||
analyzer-version = 1
|
||||
input-imports = [
|
||||
"github.com/davecgh/go-spew/spew",
|
||||
"github.com/maruel/panicparse/stack",
|
||||
"github.com/mattn/go-runewidth",
|
||||
"github.com/mitchellh/go-wordwrap",
|
||||
"github.com/nsf/termbox-go",
|
||||
|
@ -1,7 +1,3 @@
|
||||
[[constraint]]
|
||||
name = "github.com/maruel/panicparse"
|
||||
branch = "master"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/davecgh/go-spew"
|
||||
version = "1.1.0"
|
||||
|
53
render.go
53
render.go
@ -6,19 +6,10 @@ package termui
|
||||
|
||||
import (
|
||||
"image"
|
||||
"io"
|
||||
"runtime/debug"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"fmt"
|
||||
|
||||
"os"
|
||||
|
||||
"runtime/debug"
|
||||
|
||||
"bytes"
|
||||
|
||||
"github.com/maruel/panicparse/stack"
|
||||
tm "github.com/nsf/termbox-go"
|
||||
)
|
||||
|
||||
@ -104,47 +95,7 @@ func render(bs ...Bufferer) {
|
||||
defer func() {
|
||||
if e := recover(); e != nil {
|
||||
Close()
|
||||
fmt.Fprintf(os.Stderr, "Captured a panic(value=%v) when rendering Bufferer. Exit termui and clean terminal...\nPrint stack trace:\n\n", e)
|
||||
//debug.PrintStack()
|
||||
gs, err := stack.ParseDump(bytes.NewReader(debug.Stack()), os.Stderr, false)
|
||||
if err != nil {
|
||||
debug.PrintStack()
|
||||
os.Exit(1)
|
||||
}
|
||||
buckets := stack.Aggregate(gs.Goroutines, stack.AnyValue)
|
||||
for _, bucket := range buckets {
|
||||
srcLen, pkgLen := 0, 0
|
||||
for _, line := range bucket.Signature.Stack.Calls {
|
||||
if l := len(line.SrcLine()); l > srcLen {
|
||||
srcLen = l
|
||||
}
|
||||
if l := len(line.Func.PkgName()); l > pkgLen {
|
||||
pkgLen = l
|
||||
}
|
||||
}
|
||||
extra := ""
|
||||
if s := bucket.SleepString(); s != "" {
|
||||
extra += " [" + s + "]"
|
||||
}
|
||||
if bucket.Locked {
|
||||
extra += " [locked]"
|
||||
}
|
||||
if c := bucket.CreatedByString(false); c != "" {
|
||||
extra += " [Created by " + c + "]"
|
||||
}
|
||||
io.WriteString(os.Stdout, fmt.Sprintf("%d: %s%s\n", len(bucket.IDs), bucket.State, extra))
|
||||
|
||||
for _, line := range bucket.Stack.Calls {
|
||||
io.WriteString(os.Stdout, fmt.Sprintf(
|
||||
" %-*s %-*s %s(%s)\n",
|
||||
pkgLen, line.Func.PkgName(), srcLen, line.SrcLine(),
|
||||
line.Func.Name(), &line.Args))
|
||||
}
|
||||
if bucket.Stack.Elided {
|
||||
io.WriteString(os.Stdout, " (...)\n")
|
||||
}
|
||||
}
|
||||
os.Exit(1)
|
||||
panic(debug.Stack())
|
||||
}
|
||||
}()
|
||||
for _, b := range bs {
|
||||
|
Loading…
Reference in New Issue
Block a user