================
@@ -285,6 +304,111 @@ static llvm::Error
LaunchRunInTerminalTarget(llvm::opt::Arg &target_arg,
#endif
lldb_private::FileSystem::Initialize();
+
+#ifdef _WIN32
+ RunInTerminalLauncherCommChannel comm_channel(comm_file);
+
+ auto wcommandLineOrErr =
+ lldb_private::GetFlattenedWindowsCommandStringW(argv);
+ if (!wcommandLineOrErr)
+ return notifyError(comm_channel, "Failed to process arguments");
+
+ STARTUPINFOEXW startupinfoex = {};
+ startupinfoex.StartupInfo.cb = sizeof(STARTUPINFOEXW);
+ startupinfoex.StartupInfo.dwFlags |= STARTF_USESTDHANDLES;
+
+ HANDLE stdin_handle = GetStdHandle(STD_INPUT_HANDLE);
+ HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
+ HANDLE stderr_handle = GetStdHandle(STD_ERROR_HANDLE);
----------------
charles-zablit wrote:
We first get the stdin, stdout and stderr with `GetStdHandle`.
Then, if `stdio` is not empty, we overwrite all of them, whatever the length of
`stdio` is:
`--stdio 0,1,null` will result in `stdin_handle=0`, `stdout_handle=1`,
`stderr_handle=null`.
`--stdio 0,1` will result in `stdin_handle=0`, `stdout_handle=1`,
`stderr_handle=1`.
That's because of the following snippet which matches the behavior on Linux:
```cpp
llvm::SmallVector<llvm::StringRef, 3> files;
stdio.split(files, ';');
while (files.size() < 3)
files.push_back(files.back());
```
But then as you said, `GetInheritedHandles` will overwrite any null handles
with the std ones.
Is the last part something we want?
https://github.com/llvm/llvm-project/pull/174635
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits