mirror of
https://github.com/zyedidia/micro.git
synced 2025-06-18 23:05:40 -04:00
parent
95ec55fbbf
commit
b507cd26f4
@ -5,10 +5,12 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"os/signal"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-errors/errors"
|
"github.com/go-errors/errors"
|
||||||
@ -269,12 +271,25 @@ func main() {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c := make(chan os.Signal, 1)
|
||||||
|
signal.Notify(c, os.Kill, syscall.SIGTERM)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
<-c
|
||||||
|
if screen.Screen != nil {
|
||||||
|
screen.Screen.Fini()
|
||||||
|
}
|
||||||
|
os.Exit(0)
|
||||||
|
}()
|
||||||
|
|
||||||
m := clipboard.SetMethod(config.GetGlobalOption("clipboard").(string))
|
m := clipboard.SetMethod(config.GetGlobalOption("clipboard").(string))
|
||||||
clipErr := clipboard.Initialize(m)
|
clipErr := clipboard.Initialize(m)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := recover(); err != nil {
|
if err := recover(); err != nil {
|
||||||
screen.Screen.Fini()
|
if screen.Screen != nil {
|
||||||
|
screen.Screen.Fini()
|
||||||
|
}
|
||||||
fmt.Println("Micro encountered an error:", err)
|
fmt.Println("Micro encountered an error:", err)
|
||||||
// backup all open buffers
|
// backup all open buffers
|
||||||
for _, b := range buffer.OpenBuffers {
|
for _, b := range buffer.OpenBuffers {
|
||||||
|
Loading…
Reference in New Issue
Block a user