panic() does os.Exit()

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-09 10:26:12 -06:00
parent 3f54db0421
commit 9dde5d994a
2 changed files with 6 additions and 4 deletions

View File

@ -12,7 +12,6 @@ import (
"go.wit.com/widget" "go.wit.com/widget"
) )
func Add(n *tree.Node) { func Add(n *tree.Node) {
log.Log(INFO, "Add() END =", n.WidgetType, n.String()) log.Log(INFO, "Add() END =", n.WidgetType, n.String())
if n == nil { if n == nil {

View File

@ -9,6 +9,7 @@ import (
"strings" "strings"
"go.wit.com/log" "go.wit.com/log"
"go.wit.com/toolkits/tree"
"go.wit.com/widget" "go.wit.com/widget"
) )
@ -37,6 +38,7 @@ func simpleStdin() {
log.Println("Stack trace:") log.Println("Stack trace:")
debug.PrintStack() debug.PrintStack()
me.myTree.SendToolkitPanic() me.myTree.SendToolkitPanic()
os.Exit(0)
return return
} }
}() }()
@ -50,10 +52,10 @@ func simpleStdin() {
switch s { switch s {
case "l": case "l":
log.Log(NOW, "list widgets") log.Log(NOW, "list widgets")
me.treeRoot.ListWidgets() tree.ListWidgets()
case "b": case "b":
log.Log(NOW, "show buttons") log.Log(NOW, "show buttons")
me.treeRoot.ShowButtons() tree.ShowButtons()
case "g": case "g":
me.myTree.SendToolkitLoad("gocui") me.myTree.SendToolkitLoad("gocui")
case "a": case "a":
@ -63,6 +65,7 @@ func simpleStdin() {
case "p": case "p":
debug.PrintStack() debug.PrintStack()
me.myTree.SendToolkitPanic() me.myTree.SendToolkitPanic()
os.Exit(0)
return return
case "q": case "q":
return return
@ -71,7 +74,7 @@ func simpleStdin() {
default: default:
i, _ := strconv.Atoi(s) i, _ := strconv.Atoi(s)
log.Log(NOW, "got input:", i) log.Log(NOW, "got input:", i)
n := me.treeRoot.FindWidgetId(i) n := tree.FindWidgetId(i)
if n != nil { if n != nil {
n.DumpWidget("found node") n.DumpWidget("found node")
for i, s := range n.State.Strings { for i, s := range n.State.Strings {