mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-09-22 18:08:04 +00:00
rawmode_linux.go only cleared ICANON|ECHO but left ISIG enabled, so the terminal driver caught Ctrl+C and generated SIGINT. signal.Notify caught the SIGINT but no goroutine consumed the channel, effectively swallowing the signal. Fix: also clear ISIG so Ctrl+C is delivered as byte 0x03, which the line editor handles with os.Exit(130). Also set VMIN=1, VTIME=0 for proper blocking read behavior.
22 lines
256 B
Go
22 lines
256 B
Go
package main
|
|
|
|
type termios struct {
|
|
Iflag uint32
|
|
Oflag uint32
|
|
Cflag uint32
|
|
Lflag uint32
|
|
Cc [20]byte
|
|
Ispeed uint32
|
|
Ospeed uint32
|
|
}
|
|
|
|
const (
|
|
TCGETS = 0x5401
|
|
TCSETS = 0x5402
|
|
ICANON = 0x2
|
|
ECHO = 0x8
|
|
ISIG = 0x1
|
|
VMIN = 6
|
|
VTIME = 5
|
|
)
|