MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / GetCapturedString

Method GetCapturedString

tests/gtest/gtest-all.cc:10836–10853  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10834 }
10835
10836 std::string GetCapturedString() {
10837 if (uncaptured_fd_ != -1) {
10838 // Restores the original stream.
10839 fflush(nullptr);
10840 dup2(uncaptured_fd_, fd_);
10841 close(uncaptured_fd_);
10842 uncaptured_fd_ = -1;
10843 }
10844
10845 FILE* const file = posix::FOpen(filename_.c_str(), "r");
10846 if (file == nullptr) {
10847 GTEST_LOG_(FATAL) << "Failed to open tmp file " << filename_
10848 << " for capturing stream.";
10849 }
10850 const std::string content = ReadEntireFile(file);
10851 posix::FClose(file);
10852 return content;
10853 }
10854
10855 private:
10856 const int fd_; // A stream to capture.

Callers 1

GetCapturedStreamFunction · 0.80

Calls 3

FOpenFunction · 0.85
ReadEntireFileFunction · 0.85
FCloseFunction · 0.85

Tested by

no test coverage detected