[Lldb-commits] [lldb] [lldb] Correct use_editline check in IOHandlerEditline (PR #171733)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 11 03:49:13 PST 2025


================
@@ -245,8 +245,10 @@ IOHandlerEditline::IOHandlerEditline(
   SetPrompt(prompt);
 
 #if LLDB_ENABLE_LIBEDIT
-  const bool use_editline = m_input_sp && m_output_sp && m_error_sp &&
-                            m_input_sp->GetIsRealTerminal();
+  const bool use_editline =
+      m_input_sp && m_input_sp->GetIsRealTerminal() &&             // Input
+      m_output_sp && m_output_sp->GetUnlockedFile().GetStream() && // Output
+      m_error_sp && m_error_sp->GetUnlockedFile().GetStream();     // Error
----------------
DavidSpickett wrote:

What does it mean to not be able to get a stream for a file? Does it mean that that is a file as in a file on disk, rather than an output channel into something like a terminal?

Then I would understand this as use editline if:
* the input is coming from a real terminal
* the output and error are going to something we can stream to

In other words, don't use editline if it's not interactive or we'd be writing to things which must be handled like files on disk.

https://github.com/llvm/llvm-project/pull/171733


More information about the lldb-commits mailing list