From 9dde5d994a17ea8f68c695447966826718ac3373 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 9 Feb 2024 10:26:12 -0600 Subject: [PATCH] panic() does os.Exit() Signed-off-by: Jeff Carr --- action.go | 1 - stdin.go | 9 ++++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/action.go b/action.go index d2ea570..a4e5ee6 100644 --- a/action.go +++ b/action.go @@ -12,7 +12,6 @@ import ( "go.wit.com/widget" ) - func Add(n *tree.Node) { log.Log(INFO, "Add() END =", n.WidgetType, n.String()) if n == nil { diff --git a/stdin.go b/stdin.go index dde5564..fc2f2e5 100644 --- a/stdin.go +++ b/stdin.go @@ -9,6 +9,7 @@ import ( "strings" "go.wit.com/log" + "go.wit.com/toolkits/tree" "go.wit.com/widget" ) @@ -37,6 +38,7 @@ func simpleStdin() { log.Println("Stack trace:") debug.PrintStack() me.myTree.SendToolkitPanic() + os.Exit(0) return } }() @@ -50,10 +52,10 @@ func simpleStdin() { switch s { case "l": log.Log(NOW, "list widgets") - me.treeRoot.ListWidgets() + tree.ListWidgets() case "b": log.Log(NOW, "show buttons") - me.treeRoot.ShowButtons() + tree.ShowButtons() case "g": me.myTree.SendToolkitLoad("gocui") case "a": @@ -63,6 +65,7 @@ func simpleStdin() { case "p": debug.PrintStack() me.myTree.SendToolkitPanic() + os.Exit(0) return case "q": return @@ -71,7 +74,7 @@ func simpleStdin() { default: i, _ := strconv.Atoi(s) log.Log(NOW, "got input:", i) - n := me.treeRoot.FindWidgetId(i) + n := tree.FindWidgetId(i) if n != nil { n.DumpWidget("found node") for i, s := range n.State.Strings {