| 8776 | } |
| 8777 | |
| 8778 | std::string GetCapturedString() { |
| 8779 | if (uncaptured_fd_ != -1) { |
| 8780 | // Restores the original stream. |
| 8781 | fflush(NULL); |
| 8782 | dup2(uncaptured_fd_, fd_); |
| 8783 | close(uncaptured_fd_); |
| 8784 | uncaptured_fd_ = -1; |
| 8785 | } |
| 8786 | |
| 8787 | FILE* const file = posix::FOpen(filename_.c_str(), "r"); |
| 8788 | const std::string content = ReadEntireFile(file); |
| 8789 | posix::FClose(file); |
| 8790 | return content; |
| 8791 | } |
| 8792 | |
| 8793 | private: |
| 8794 | // Reads the entire content of a file as an std::string. |
no test coverage detected