diff options
| -rw-r--r-- | keybindings.go | 2 | ||||
| -rw-r--r-- | main.go | 20 | ||||
| -rw-r--r-- | plugin.go | 2 |
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 }) @@ -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 } }() @@ -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() |
