catch sigint and restore term
This commit is contained in:
parent
874836ba74
commit
cc613e8962
8
admin.go
8
admin.go
|
@ -25,6 +25,7 @@ import (
|
|||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
)
|
||||
|
||||
func adminscreen() {
|
||||
|
@ -98,6 +99,13 @@ func adminscreen() {
|
|||
C.tcsetattr(1, C.TCSAFLUSH, savedtio)
|
||||
}
|
||||
defer restore()
|
||||
go func() {
|
||||
sig := make(chan os.Signal)
|
||||
signal.Notify(sig, os.Interrupt)
|
||||
<-sig
|
||||
restore()
|
||||
os.Exit(0)
|
||||
}()
|
||||
|
||||
init := func() {
|
||||
tio := new(C.struct_termios)
|
||||
|
|
Loading…
Reference in New Issue