Skip to content
Snippets Groups Projects
Commit 86bc9d50 authored by Junegunn Choi's avatar Junegunn Choi
Browse files

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.
parent eee45a95
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,6 @@ import "C"
import (
"fmt"
"os"
"os/signal"
"syscall"
"time"
"unicode/utf8"
......@@ -271,14 +270,6 @@ func Init(theme *ColorTheme, black bool, mouse bool) {
C.noecho()
C.raw() // stty dsusp undef
intChan := make(chan os.Signal, 1)
signal.Notify(intChan, os.Interrupt, os.Kill)
go func() {
<-intChan
Close()
os.Exit(2)
}()
if theme != nil {
C.start_color()
initPairs(theme, black)
......
......@@ -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() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment