make sure the standard "replace input carriage returns with line feeds" and "replace output line feeds with carriage return and line feed" flags are set, even on raw (I dont think it should actually be raw)

This commit is contained in:
Jeff Lindsay 2013-02-20 12:19:22 +00:00
parent 29aab0e4bf
commit 4e24b235c3
1 changed files with 4 additions and 2 deletions

View File

@ -125,7 +125,9 @@ func MakeRaw(fd int) (*State, error) {
} }
newState := oldState.termios newState := oldState.termios
newState.Iflag &^= istrip | INLCR | ICRNL | IGNCR | IXON | IXOFF newState.Iflag &^= ISTRIP | INLCR | IGNCR | IXON | IXOFF
newState.Iflag |= ICRNL
newState.Oflag |= ONLCR
newState.Lflag &^= ECHO | ICANON | ISIG newState.Lflag &^= ECHO | ICANON | ISIG
if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), uintptr(setTermios), uintptr(unsafe.Pointer(&newState)), 0, 0, 0); err != 0 { if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), uintptr(setTermios), uintptr(unsafe.Pointer(&newState)), 0, 0, 0); err != 0 {
return nil, err return nil, err