33package cli
44
55import (
6- "syscall "
6+ "golang.org/x/sys/windows "
77)
88
99type terminalState struct {
1010 mode uint32
1111}
1212
1313func makeRaw (fd int ) (* terminalState , error ) {
14- handle := syscall .Handle (fd )
14+ handle := windows .Handle (fd )
1515 var original uint32
16- if err := syscall .GetConsoleMode (handle , & original ); err != nil {
16+ if err := windows .GetConsoleMode (handle , & original ); err != nil {
1717 return nil , err
1818 }
1919
2020 raw := original
21- raw &^= syscall .ENABLE_ECHO_INPUT
22- raw &^= syscall .ENABLE_LINE_INPUT
23- raw &^= syscall .ENABLE_PROCESSED_INPUT
24- raw |= syscall .ENABLE_VIRTUAL_TERMINAL_INPUT
21+ raw &^= windows .ENABLE_ECHO_INPUT
22+ raw &^= windows .ENABLE_LINE_INPUT
23+ raw &^= windows .ENABLE_PROCESSED_INPUT
24+ raw |= windows .ENABLE_VIRTUAL_TERMINAL_INPUT
2525
26- if err := syscall .SetConsoleMode (handle , raw ); err != nil {
26+ if err := windows .SetConsoleMode (handle , raw ); err != nil {
2727 return nil , err
2828 }
2929
@@ -34,6 +34,6 @@ func restore(fd int, state *terminalState) {
3434 if state == nil {
3535 return
3636 }
37- handle := syscall .Handle (fd )
38- _ = syscall .SetConsoleMode (handle , state .mode )
37+ handle := windows .Handle (fd )
38+ _ = windows .SetConsoleMode (handle , state .mode )
3939}
0 commit comments