mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-25 18:07:07 +09:00
micro: Rearrange signal creation (#4027)
Otherwise we can't properly react upon screen events or signals created within early plugin functions.
This commit is contained in:
@@ -363,6 +363,12 @@ func main() {
|
|||||||
fmt.Println("Fatal: Micro could not initialize a Screen.")
|
fmt.Println("Fatal: Micro could not initialize a Screen.")
|
||||||
exit(1)
|
exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
util.Sigterm = make(chan os.Signal, 1)
|
||||||
|
sighup = make(chan os.Signal, 1)
|
||||||
|
signal.Notify(util.Sigterm, syscall.SIGTERM, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGABRT)
|
||||||
|
signal.Notify(sighup, syscall.SIGHUP)
|
||||||
|
|
||||||
m := clipboard.SetMethod(config.GetGlobalOption("clipboard").(string))
|
m := clipboard.SetMethod(config.GetGlobalOption("clipboard").(string))
|
||||||
clipErr := clipboard.Initialize(m)
|
clipErr := clipboard.Initialize(m)
|
||||||
|
|
||||||
@@ -400,6 +406,8 @@ func main() {
|
|||||||
action.InitBindings()
|
action.InitBindings()
|
||||||
action.InitCommands()
|
action.InitCommands()
|
||||||
|
|
||||||
|
timerChan = make(chan func())
|
||||||
|
|
||||||
err = config.RunPluginFn("preinit")
|
err = config.RunPluginFn("preinit")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
screen.TermMessage(err)
|
screen.TermMessage(err)
|
||||||
@@ -444,13 +452,6 @@ func main() {
|
|||||||
|
|
||||||
screen.Events = make(chan tcell.Event)
|
screen.Events = make(chan tcell.Event)
|
||||||
|
|
||||||
util.Sigterm = make(chan os.Signal, 1)
|
|
||||||
sighup = make(chan os.Signal, 1)
|
|
||||||
signal.Notify(util.Sigterm, syscall.SIGTERM, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGABRT)
|
|
||||||
signal.Notify(sighup, syscall.SIGHUP)
|
|
||||||
|
|
||||||
timerChan = make(chan func())
|
|
||||||
|
|
||||||
// Here is the event loop which runs in a separate thread
|
// Here is the event loop which runs in a separate thread
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
|
|||||||
Reference in New Issue
Block a user