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

Charles Zablit via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 2 06:35:15 PDT 2026


https://github.com/charles-zablit created https://github.com/llvm/llvm-project/pull/190178

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.

>From 613fa2fc302886ca2c1252e212897e534e892231 Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Thu, 2 Apr 2026 14:28:41 +0100
Subject: [PATCH] [lldb][windows] simplify the ConPTY draining subprocess

---
 lldb/source/Host/windows/PseudoConsole.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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');
 



More information about the lldb-commits mailing list