mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-18 22:44:50 +02:00
Start work on proper TUI support
This commit is contained in:
@@ -12,20 +12,9 @@ import (
|
||||
// Go unix does not wrap pselect on darwin
|
||||
|
||||
func Select(nfd int, r *unix.FdSet, w *unix.FdSet, e *unix.FdSet, timeout time.Duration) (n int, err error) {
|
||||
deadline := time.Now().Add(timeout)
|
||||
for {
|
||||
t := deadline.Sub(time.Now())
|
||||
if t < 0 {
|
||||
t = 0
|
||||
}
|
||||
ts := NsecToTimeval(t)
|
||||
q, qerr := unix.Select(nfd, r, w, w, &ts)
|
||||
if qerr == unix.EINTR {
|
||||
if time.Now().After(deadline) {
|
||||
return 0, os.ErrDeadlineExceeded
|
||||
}
|
||||
continue
|
||||
}
|
||||
return q, qerr
|
||||
if timeout < 0 {
|
||||
return unix.Select(nfd, r, w, e, nil)
|
||||
}
|
||||
ts := NsecToTimeval(timeout)
|
||||
return unix.Select(nfd, r, w, e, &ts)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user