mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-18 06:25:13 +02:00
Code to write to cache file
This commit is contained in:
@@ -68,3 +68,17 @@ self_pipe(int fds[2], bool nonblock) {
|
||||
return pipe2(fds, flags) == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
drain_fd(int fd) {
|
||||
static uint8_t drain_buf[1024];
|
||||
while(true) {
|
||||
ssize_t len = read(fd, drain_buf, sizeof(drain_buf));
|
||||
if (len < 0) {
|
||||
if (errno == EINTR) continue;
|
||||
break;
|
||||
}
|
||||
if (len > 0) continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user