| 9604 | } |
| 9605 | |
| 9606 | std::string GetCapturedString() { |
| 9607 | if (uncaptured_fd_ != -1) { |
| 9608 | // Restores the original stream. |
| 9609 | fflush(NULL); |
| 9610 | dup2(uncaptured_fd_, fd_); |
| 9611 | close(uncaptured_fd_); |
| 9612 | uncaptured_fd_ = -1; |
| 9613 | } |
| 9614 | |
| 9615 | FILE* const file = posix::FOpen(filename_.c_str(), "r"); |
| 9616 | const std::string content = ReadEntireFile(file); |
| 9617 | posix::FClose(file); |
| 9618 | return content; |
| 9619 | } |
| 9620 | |
| 9621 | private: |
| 9622 | // Reads the entire content of a file as an std::string. |
no test coverage detected