void TearDown()

in src/oomd/util/FixtureTest.cpp [21:43]


  void TearDown() override {
    DIR* dir;
    std::string failureMsg = "";
    for (const auto& tempDir : tempDirs_) {
      dir = ::opendir(tempDir.c_str());
      if (dir != nullptr) {
        ::closedir(dir);
        // call `rm -r '$tempDir'` to remove recursively
        const auto& cmd = "rm -r '" + tempDir + "'";
        auto stream = ::popen(cmd.c_str(), "r");
        if (stream != nullptr) {
          ::pclose(stream);
        }
        dir = ::opendir(tempDir.c_str());
        if (dir != nullptr || errno != ENOENT) {
          failureMsg += " " + tempDir;
        }
      }
    }
    if (failureMsg != "") {
      FAIL() << "remove failed:" + failureMsg;
    }
  }