[Lldb-commits] [lldb] [lldb-dap] Implement `runInTerminal` for Windows (PR #121269)
John Harrison via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 10 09:53:15 PST 2025
================
@@ -158,13 +156,25 @@ std::string RunInTerminalDebugAdapterCommChannel::GetLauncherError() {
}
Expected<std::shared_ptr<FifoFile>> CreateRunInTerminalCommFile() {
+ int comm_fd;
SmallString<256> comm_file;
- if (std::error_code EC = sys::fs::getPotentiallyUniqueTempFileName(
- "lldb-dap-run-in-terminal-comm", "", comm_file))
+ if (std::error_code EC = createUniqueNamedPipe(
+ "lldb-dap-run-in-terminal-comm", "", comm_fd, comm_file))
return createStringError(EC, "Error making unique file name for "
"runInTerminal communication files");
-
- return CreateFifoFile(comm_file.str());
+ FILE *cf = fdopen(comm_fd, "r+");
+ if (setvbuf(cf, NULL, _IONBF, 0))
+ return createStringError(std::error_code(errno, std::generic_category()),
+ "Error setting unbuffered mode on C FILE");
+ // There is no portable way to conjure an ofstream from HANDLE, so use FILE *
+ // llvm::raw_fd_stream does not support getline() and there is no
+ // llvm::buffer_istream
----------------
ashgti wrote:
If you have the path, can't you use that to open the file with `std::ofstream`?
https://github.com/llvm/llvm-project/pull/121269
More information about the lldb-commits
mailing list