Better backup behavior

This commit is contained in:
Zachary Yedidia
2019-12-21 23:26:53 -05:00
parent a9bb1f35da
commit c4d5d7c195
4 changed files with 25 additions and 7 deletions

View File

@@ -190,6 +190,10 @@ func main() {
if err := recover(); err != nil {
screen.Screen.Fini()
fmt.Println("Micro encountered an error:", err)
// backup all open buffers
for _, b := range buffer.OpenBuffers {
b.Backup(false)
}
// Print the stack trace too
fmt.Print(errors.Wrap(err, 2).ErrorStack())
os.Exit(1)