We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d0c3e88 commit 59cd548Copy full SHA for 59cd548
monitor.go
@@ -6,6 +6,7 @@ import (
6
"fmt"
7
"os"
8
"os/signal"
9
+ "syscall"
10
"time"
11
12
"github.com/mattn/go-tty"
@@ -42,13 +43,18 @@ func Monitor(port string, baud int) error {
42
43
defer tty.Close()
44
45
sig := make(chan os.Signal, 1)
- signal.Notify(sig, os.Interrupt)
46
+ signal.Notify(sig, os.Interrupt, syscall.SIGQUIT)
47
defer signal.Stop(sig)
48
49
go func() {
50
for {
- <-sig
51
- p.Write([]byte{0x1b, 0x03}) // send ctrl+c to tty
+ sig := <-sig
52
+ switch sig {
53
+ case os.Interrupt:
54
+ p.Write([]byte{0x1b, 0x03}) // send ctrl+c to tty
55
+ case syscall.SIGQUIT:
56
+ p.Write([]byte{0x1b, 0x1c}) // send ctrl+\ to tty
57
+ }
58
}
59
}()
60
0 commit comments