mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-23 03:19:01 +00:00
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:
parent
eee45a9578
commit
86bc9d506f
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user