mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-23 19:39:07 +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 (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
@ -271,14 +270,6 @@ func Init(theme *ColorTheme, black bool, mouse bool) {
|
|||||||
C.noecho()
|
C.noecho()
|
||||||
C.raw() // stty dsusp undef
|
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 {
|
if theme != nil {
|
||||||
C.start_color()
|
C.start_color()
|
||||||
initPairs(theme, black)
|
initPairs(theme, black)
|
||||||
|
@ -727,6 +727,13 @@ func (t *Terminal) Loop() {
|
|||||||
t.reqBox.Set(reqRefresh, nil)
|
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)
|
resizeChan := make(chan os.Signal, 1)
|
||||||
signal.Notify(resizeChan, syscall.SIGWINCH)
|
signal.Notify(resizeChan, syscall.SIGWINCH)
|
||||||
go func() {
|
go func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user