[Lldb-commits] [lldb] [lldb][windows] simplify the ConPTY draining subprocess (PR #190178)

via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 2 06:36:00 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)

<details>
<summary>Changes</summary>

In some environments like swiftlang, the `''` causes the command used to drain the init sequence of the ConPTY to fail. Replacing with a `cls` invocation removes the need for quotation marks and works just as well.

---
Full diff: https://github.com/llvm/llvm-project/pull/190178.diff


1 Files Affected:

- (modified) lldb/source/Host/windows/PseudoConsole.cpp (+1-1) 


``````````diff
diff --git a/lldb/source/Host/windows/PseudoConsole.cpp b/lldb/source/Host/windows/PseudoConsole.cpp
index 7c5818c03e37f..bf11a08cc1b85 100644
--- a/lldb/source/Host/windows/PseudoConsole.cpp
+++ b/lldb/source/Host/windows/PseudoConsole.cpp
@@ -252,7 +252,7 @@ llvm::Error PseudoConsole::DrainInitSequences() {
         std::error_code(GetLastError(), std::system_category()),
         "Failed to get the 'COMSPEC' environment variable");
 
-  std::wstring cmdline_str = std::wstring(comspec) + L" /c 'echo foo && exit'";
+  std::wstring cmdline_str = std::wstring(comspec) + L" /c cls";
   std::vector<wchar_t> cmdline(cmdline_str.begin(), cmdline_str.end());
   cmdline.push_back(L'\0');
 

``````````

</details>


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


More information about the lldb-commits mailing list