[Lldb-commits] [lldb] [lldb][windows] fix command source hitting EOF (PR #194950)
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Fri May 1 09:53:18 PDT 2026
================
@@ -356,6 +356,15 @@ FILE *NativeFile::GetStream() {
if (m_stream) {
m_own_stream = true;
m_own_descriptor = false;
+#ifdef _WIN32
+ // On Windows, the first fgets() fills the C-runtime's internal
+ // buffer with one large OS read, leaving the underlying fd at EOF.
+ // Code that later opens the same fd then immediately hits EOF.
+ // Disabling buffering here, before any I/O touches the stream, keeps
+ // the fd in sync with what has been logically consumed.
+ if ((m_options & OpenOptionsModeMask) == eOpenOptionReadOnly)
+ setvbuf(m_stream, nullptr, _IONBF, 0);
+#endif
----------------
adrian-prantl wrote:
Shouldn't this be in a `Host/windows` overload rather than in the main implementeation and an ifdef?
https://github.com/llvm/llvm-project/pull/194950
More information about the lldb-commits
mailing list