================
@@ -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
----------------
charles-zablit wrote:
> What exactly is your concern? If we design it right, parts of the
> implementation will remain in Common and only the platform specific parts are
> moved out.
You are right, I was thinking of `ProcessLauncher` and `NativeProcessWindows`,
but they are very different.
I opened a PR to make the refactor here:
- https://github.com/llvm/llvm-project/pull/196293
https://github.com/llvm/llvm-project/pull/194950
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits