From d09b01ff8efe6da38e87007566b23c7c73c51314 Mon Sep 17 00:00:00 2001 From: JianFeeeee <109188060+JianFeeeee@users.noreply.github.com> Date: Sun, 19 Jul 2026 12:25:21 +0800 Subject: [PATCH] fix: waiter Ctrl+C not responding in interactive mode 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. --- cmd/waiter/rawmode_defs.go | 3 +++ cmd/waiter/rawmode_linux.go | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/waiter/rawmode_defs.go b/cmd/waiter/rawmode_defs.go index 4f147aac..3301601a 100644 --- a/cmd/waiter/rawmode_defs.go +++ b/cmd/waiter/rawmode_defs.go @@ -15,4 +15,7 @@ const ( TCSETS = 0x5402 ICANON = 0x2 ECHO = 0x8 + ISIG = 0x1 + VMIN = 6 + VTIME = 5 ) diff --git a/cmd/waiter/rawmode_linux.go b/cmd/waiter/rawmode_linux.go index 5cb92c6b..692d931e 100644 --- a/cmd/waiter/rawmode_linux.go +++ b/cmd/waiter/rawmode_linux.go @@ -13,7 +13,9 @@ func setRawMode(fd int) (func(), error) { return func() {}, err } new := old - new.Lflag &^= ICANON | ECHO + new.Lflag &^= ICANON | ECHO | ISIG + new.Cc[VMIN] = 1 + new.Cc[VTIME] = 0 if _, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(fd), TCSETS, uintptr(unsafe.Pointer(&new))); err != 0 { return func() {}, err }