================ @@ -24,41 +30,95 @@ using namespace llvm; namespace lldb_dap { -FifoFile::FifoFile(StringRef path) : m_path(path) {} +std::error_code EC; +FifoFile::FifoFile(StringRef path) + : m_path(path), m_file(fopen(path.data(), "r+")) { + if (m_file == nullptr) { + EC = std::error_code(errno, std::generic_category()); + llvm::errs() << "Failed to open fifo file " << path << ": " << EC.message() + << "\n"; + std::terminate(); + } + if (setvbuf(m_file, NULL, _IONBF, 0)) + llvm::errs() << "Error setting unbuffered mode on C FILE\n"; +} +FifoFile::FifoFile(StringRef path, FILE *f) : m_path(path), m_file(f) {} +FifoFile::FifoFile(FifoFile &&other) + : m_path(other.m_path), m_file(other.m_file) { + other.m_file = nullptr; ---------------- SuibianP wrote:
Called `clear` on it. Also fixed one place where the moved `m_path` was still used. https://github.com/llvm/llvm-project/pull/121269 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits