...

Source file src/github.com/moby/term/termios_unix.go

Documentation: github.com/moby/term

     1  //go:build !windows
     2  // +build !windows
     3  
     4  package term
     5  
     6  import (
     7  	"golang.org/x/sys/unix"
     8  )
     9  
    10  // Termios is the Unix API for terminal I/O.
    11  //
    12  // Deprecated: use [unix.Termios].
    13  type Termios = unix.Termios
    14  
    15  func makeRaw(fd uintptr) (*State, error) {
    16  	termios, err := tcget(fd)
    17  	if err != nil {
    18  		return nil, err
    19  	}
    20  
    21  	oldState := State{termios: *termios}
    22  
    23  	termios.Iflag &^= unix.IGNBRK | unix.BRKINT | unix.PARMRK | unix.ISTRIP | unix.INLCR | unix.IGNCR | unix.ICRNL | unix.IXON
    24  	termios.Oflag &^= unix.OPOST
    25  	termios.Lflag &^= unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN
    26  	termios.Cflag &^= unix.CSIZE | unix.PARENB
    27  	termios.Cflag |= unix.CS8
    28  	termios.Cc[unix.VMIN] = 1
    29  	termios.Cc[unix.VTIME] = 0
    30  
    31  	if err := tcset(fd, termios); err != nil {
    32  		return nil, err
    33  	}
    34  	return &oldState, nil
    35  }
    36  

View as plain text