Fix invalid interrupt handler during execute action

Interrupt handling during execute action was not serialized and often
caused crash, failed to restore the terminal state.
This commit is contained in:
Junegunn Choi
2015-10-05 23:19:26 +09:00
parent eee45a9578
commit 86bc9d506f
2 changed files with 7 additions and 9 deletions

View File

@@ -727,6 +727,13 @@ func (t *Terminal) Loop() {
t.reqBox.Set(reqRefresh, nil)
}()
intChan := make(chan os.Signal, 1)
signal.Notify(intChan, os.Interrupt, os.Kill)
go func() {
<-intChan
t.reqBox.Set(reqQuit, nil)
}()
resizeChan := make(chan os.Signal, 1)
signal.Notify(resizeChan, syscall.SIGWINCH)
go func() {