diff --git a/lldb/unittests/tools/lldb-server/tests/LLGSTest.cpp b/lldb/unittests/tools/lldb-server/tests/LLGSTest.cpp --- a/lldb/unittests/tools/lldb-server/tests/LLGSTest.cpp +++ b/lldb/unittests/tools/lldb-server/tests/LLGSTest.cpp @@ -41,9 +41,10 @@ // Test that --env takes precedence over inherited environment variables. putenv(const_cast("LLDB_TEST_MAGIC_VARIABLE=foobar")); - auto ClientOr = TestClient::launchCustom(getLogFileName(), - { "--env", "LLDB_TEST_MAGIC_VARIABLE=LLDB_TEST_MAGIC_VALUE" }, - {getInferiorPath("environment_check")}); + auto ClientOr = TestClient::launchCustom( + getLogFileName(), /* disable_stdio */ true, + {"--env", "LLDB_TEST_MAGIC_VARIABLE=LLDB_TEST_MAGIC_VALUE"}, + {getInferiorPath("environment_check")}); ASSERT_THAT_EXPECTED(ClientOr, Succeeded()); auto &Client = **ClientOr; diff --git a/lldb/unittests/tools/lldb-server/tests/TestClient.h b/lldb/unittests/tools/lldb-server/tests/TestClient.h --- a/lldb/unittests/tools/lldb-server/tests/TestClient.h +++ b/lldb/unittests/tools/lldb-server/tests/TestClient.h @@ -48,8 +48,9 @@ /// using this for generic tests, as the two stubs have different /// command-line interfaces. static llvm::Expected> - launchCustom(llvm::StringRef Log, llvm::ArrayRef ServerArgs, llvm::ArrayRef InferiorArgs); - + launchCustom(llvm::StringRef Log, bool disable_stdio, + llvm::ArrayRef ServerArgs, + llvm::ArrayRef InferiorArgs); ~TestClient() override; llvm::Error SetInferior(llvm::ArrayRef inferior_args); diff --git a/lldb/unittests/tools/lldb-server/tests/TestClient.cpp b/lldb/unittests/tools/lldb-server/tests/TestClient.cpp --- a/lldb/unittests/tools/lldb-server/tests/TestClient.cpp +++ b/lldb/unittests/tools/lldb-server/tests/TestClient.cpp @@ -59,10 +59,13 @@ } Expected> TestClient::launch(StringRef Log, ArrayRef InferiorArgs) { - return launchCustom(Log, {}, InferiorArgs); + return launchCustom(Log, false, {}, InferiorArgs); } -Expected> TestClient::launchCustom(StringRef Log, ArrayRef ServerArgs, ArrayRef InferiorArgs) { +Expected> +TestClient::launchCustom(StringRef Log, bool disable_stdio, + ArrayRef ServerArgs, + ArrayRef InferiorArgs) { const ArchSpec &arch_spec = HostInfo::GetArchitecture(); Args args; args.AppendArgument(LLDB_SERVER); @@ -111,6 +114,8 @@ // Accept(). Info.SetMonitorProcessCallback(&ProcessLaunchInfo::NoOpMonitorCallback); + if (disable_stdio) + Info.GetFlags().Set(lldb::eLaunchFlagDisableSTDIO); status = Host::LaunchProcess(Info); if (status.Fail()) return status.ToError();