Handle EINTR in IsTerminal

This commit is contained in:
Kovid Goyal 2022-08-23 11:16:38 +05:30
parent 10cef16210
commit 67f03621ae
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -20,12 +20,6 @@ const (
TCSAFLUSH = 2
)
func IsTerminal(fd uintptr) bool {
var t unix.Termios
err := Tcgetattr(int(fd), &t)
return err == nil
}
type Term struct {
name string
fd int
@ -52,6 +46,12 @@ func eintr_retry_intret(f func() (int, error)) (int, error) {
}
}
func IsTerminal(fd uintptr) bool {
var t unix.Termios
err := eintr_retry_noret(func() error { return Tcgetattr(int(fd), &t) })
return err == nil
}
type TermiosOperation func(t *unix.Termios)
func get_vmin_and_vtime(d time.Duration) (uint8, uint8) {