summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-30 11:54:57 -0600
committerJeff Carr <[email protected]>2024-01-30 11:54:57 -0600
commit3f2f3de751ed9863ab798853b2a09db6b745a1b0 (patch)
treeb16b18d0b54f3a028a59359485611f7b82a8eaf9
parentf1b86c4e38075bb648059992eb38de040669c2bf (diff)
try to get toolkit to closev0.18.0
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--keybindings.go2
-rw-r--r--main.go20
-rw-r--r--plugin.go2
3 files changed, 15 insertions, 9 deletions
diff --git a/keybindings.go b/keybindings.go
index f798fdb..9059f72 100644
--- a/keybindings.go
+++ b/keybindings.go
@@ -172,7 +172,7 @@ func addDebugKeys(g *gocui.Gui) {
// panic
g.SetKeybinding("", 'p', gocui.ModNone,
func(g *gocui.Gui, v *gocui.View) error {
- standardExit()
+ standardClose()
panic("forced panic in gocui")
return nil
})
diff --git a/main.go b/main.go
index b2c0fd7..8e75031 100644
--- a/main.go
+++ b/main.go
@@ -35,12 +35,6 @@ func init() {
log.Sleep(.1) // probably not needed, but in here for now under development
}
-func Exit() {
- // TODO: what should actually happen here?
- log.Log(NOW, "Exit() here. doing standardExit()")
- standardExit()
-}
-
func standardExit() {
log.Log(NOW, "standardExit() doing baseGui.Close()")
me.baseGui.Close()
@@ -56,6 +50,17 @@ func standardExit() {
os.Exit(0)
}
+func standardClose() {
+ log.Log(NOW, "standardExit() doing baseGui.Close()")
+ me.baseGui.Close()
+ log.Log(NOW, "standardExit() doing outf.Close()")
+ outf.Close()
+ os.Stdin = os.Stdin
+ os.Stdout = os.Stdout
+ os.Stderr = os.Stderr
+ log.Log(NOW, "standardExit() send back Quit()")
+}
+
var outf *os.File
func main() {
@@ -66,9 +71,10 @@ func mainGogui() {
if r := recover(); r != nil {
log.Warn("YAHOOOO Recovered in guiMain application:", r)
log.Warn("Recovered from panic:", r)
+ me.myTree.SendToolkitPanic()
log.Warn("Stack trace:")
debug.PrintStack()
- me.myTree.SendToolkitPanic()
+ // panic("BUMMER")
return
}
}()
diff --git a/plugin.go b/plugin.go
index c8bd88c..204b77a 100644
--- a/plugin.go
+++ b/plugin.go
@@ -82,7 +82,7 @@ func action(a widget.Action) {
log.Log(NOW, "attempt to move() =", a.ActionType, a.WidgetType, a.ProgName)
case widget.ToolkitClose:
log.Log(NOW, "attempting to close the plugin and release stdout and stderr")
- standardExit()
+ standardClose()
case widget.Enable:
w.enable = true
w.enableColor()