| 108 | } |
| 109 | |
| 110 | void writeRetry(int fd, const std::string & data) |
| 111 | { |
| 112 | size_t bytes_written = 0; |
| 113 | const char * begin = data.c_str(); |
| 114 | size_t offset = data.size(); |
| 115 | |
| 116 | while (bytes_written != offset) |
| 117 | { |
| 118 | ssize_t res = ::write(fd, begin + bytes_written, offset - bytes_written); |
| 119 | if ((-1 == res || 0 == res) && errno != EINTR) |
| 120 | throw std::runtime_error(fmt::format("Cannot write to {}: {}", fd, errnoToString())); |
| 121 | bytes_written += res; |
| 122 | } |
| 123 | } |
| 124 | std::string readFile(const std::string & path) |
| 125 | { |
| 126 | std::string out; |
no test coverage detected