diff --git a/go/src/fullcycle/analog-kernel/main.go b/go/src/fullcycle/analog-kernel/main.go index ecb5ae4..61e4df0 100644 --- a/go/src/fullcycle/analog-kernel/main.go +++ b/go/src/fullcycle/analog-kernel/main.go @@ -10,9 +10,14 @@ import ( "os" "strings" + "golang.org/x/sys/unix" + "fullcycle/analog-kernel/parser" ) +const ioctlReadTermios = unix.TCGETS +const ioctlWriteTermios = unix.TCSETS + const defaultResult = ` { "result": { @@ -73,6 +78,17 @@ func init() { } func main() { + // Disable echo for stdin. + termios, err := unix.IoctlGetTermios(0, ioctlReadTermios) + check(err) + + termios.Lflag &= ^(uint32(unix.ECHO | unix.ICANON)) + termios.Cc[unix.VMIN] = 1 + termios.Cc[unix.VTIME] = 0 + + err = unix.IoctlSetTermios(0, ioctlWriteTermios, termios) + check(err) + var r parser.Request // Read the sheet.