<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/144077>144077</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
lldb's HostTests cause Windows Terminal to completely exit
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lldb,
platform:windows
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DavidSpickett
</td>
</tr>
</table>
<pre>
Found this on Linaro's Windows on Arm bot. Build lldb as normal in a Windows Terminal (not conhost) and then:
```
ninja check-lldb-unit
```
When this gets to host tests, the current terminal and any other terminal windows will close at some point during the tests.
I narrowed it down to:
```
TEST(Host, FindProcesses) {
SubsystemRAII<FileSystem, HostInfo> subsystems;
if (test_arg != 0) {
// Give the parent time to retrieve information about self.
// It will kill self when it is done.
std::this_thread::sleep_for(std::chrono::seconds(10));
exit(0);
}
bool foundPID = false;
ProcessLaunchInfo info;
ProcessInstanceInfoList processes;
ProcessInstanceInfoMatch match(TestMainArgv0, NameMatch::Equals);
info.SetExecutableFile(FileSpec(TestMainArgv0),
/*add_exe_file_as_first_arg=*/true);
info.GetArguments().AppendArgument("--gtest_filter=Host.FindProcesses");
info.GetArguments().AppendArgument("--test-arg=48");
std::promise<int> exit_status;
info.SetMonitorProcessCallback([&](lldb::pid_t pid, int signal, int status) {
exit_status.set_value(status);
});
ASSERT_THAT_ERROR(Host::LaunchProcess(info).takeError(), Succeeded());
ASSERT_TRUE(Host::FindProcesses(match, processes));
for (const auto &process : processes) {
if (process.GetProcessID() == info.GetProcessID()) {
ASSERT_EQ(process.GetExecutableFile().GetFilename(),
info.GetExecutableFile().GetFilename());
foundPID = true;
}
}
ASSERT_TRUE(foundPID);
auto clean_up = llvm::make_scope_exit([&] {
Host::Kill(info.GetProcessID(), SIGKILL);
exit_status.get_future().get();
});
}
```
Same thing happens if you run HostTests.exe directly.
Working theory is that it is finding the wrong process and managing to SIGKILL the terminal itself.
</pre>
<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