mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-11-14 12:11:12 +03:00
DRYer
This commit is contained in:
parent
e7e401c8dd
commit
2707c44f0f
@ -52,20 +52,13 @@ func read_input(input_file *os.File, input_file_name string, input_channel chan<
|
||||
}
|
||||
}
|
||||
|
||||
read_with_retry := func(b []byte) (n int, err error) {
|
||||
for {
|
||||
n, err = input_file.Read(b)
|
||||
if err != unix.EAGAIN && err != unix.EINTR {
|
||||
break
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
for err != nil {
|
||||
n, err = read_with_retry(buf_array[:])
|
||||
n, err = input_file.Read(buf_array[:])
|
||||
if n > 0 {
|
||||
process_chunk(buf_array[:n])
|
||||
}
|
||||
if err == unix.EAGAIN || err == unix.EINTR {
|
||||
err = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user