catch sigint and restore term
Ted Unangst tedu@tedunangst.com
Sun, 10 Nov 2019 20:20:56 -0500
1 files changed,
8 insertions(+),
0 deletions(-)
jump to
M
admin.go
→
admin.go
@@ -25,6 +25,7 @@ "fmt"
"io/ioutil" "log" "os" + "os/signal" ) func adminscreen() {@@ -98,6 +99,13 @@ stdout.Flush()
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)