handle race condition while setting raw mode in windows (#2509)

This commit is contained in:
Patrick Devine
2024-02-14 21:28:35 -08:00
committed by GitHub
parent 9241a29336
commit 42e77e2a69
5 changed files with 38 additions and 15 deletions

View File

@@ -56,7 +56,8 @@ func SetRawMode(fd int) (*State, error) {
return &State{st}, nil
}
func UnsetRawMode(fd int, state *State) error {
_, _, err := syscall.SyscallN(procSetConsoleMode.Addr(), uintptr(fd), uintptr(state.mode), 0)
func UnsetRawMode(fd int, state any) error {
s := state.(*State)
_, _, err := syscall.SyscallN(procSetConsoleMode.Addr(), uintptr(fd), uintptr(s.mode), 0)
return err
}