| 233 | } |
| 234 | |
| 235 | int ipipe::read(std::string &data) |
| 236 | { |
| 237 | if (!opened()) |
| 238 | return report(EINVAL, "ipipe::read"); |
| 239 | data.clear(); |
| 240 | auto buffer = std::array<char, 128>{}; |
| 241 | while (!std::feof(file_) && !std::ferror(file_)) { |
| 242 | auto count = |
| 243 | std::fread(buffer.data(), sizeof(char), buffer.size(), file_); |
| 244 | if (count > 0) |
| 245 | data.append(buffer.data(), count); |
| 246 | } |
| 247 | if (std::ferror(file_)) |
| 248 | return report(EIO, "fread"); |
| 249 | return 0; |
| 250 | } |
| 251 | |
| 252 | int shell_write(const std::string &cmd, std::string &data) |
| 253 | { |
no test coverage detected