From 8d64089ecf09e96672f741a9d56b06e7919639d3 Mon Sep 17 00:00:00 2001
From: Charles Bousseau <cbousseau@anaconda.com>
Date: Mon, 13 May 2024 16:46:45 -0400
Subject: [PATCH] Do not capture stdout on osx tests

---
 .../protobuf/compiler/command_line_interface_tester.cc      | 5 +++--
 .../protobuf/compiler/command_line_interface_unittest.cc    | 6 +++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/google/protobuf/compiler/command_line_interface_tester.cc b/src/google/protobuf/compiler/command_line_interface_tester.cc
index 794810832..5227fcee1 100644
--- a/src/google/protobuf/compiler/command_line_interface_tester.cc
+++ b/src/google/protobuf/compiler/command_line_interface_tester.cc
@@ -70,7 +70,8 @@ void CommandLineInterfaceTester::RunProtocWithArgs(
   // TODO: Cygwin doesn't work well if we try to capture stderr and
   // stdout at the same time. Need to figure out why and add this capture back
   // for Cygwin.
-#if !defined(__CYGWIN__)
+  // Anaconda: This happens on our OSX builders as well.
+#if !defined(__CYGWIN__) && !defined(__APPLE__)
   CaptureTestStdout();
 #endif
   CaptureTestStderr();
@@ -78,7 +79,7 @@ void CommandLineInterfaceTester::RunProtocWithArgs(
   return_code_ = cli_.Run(static_cast<int>(args.size()), argv.data());
 
   error_text_ = GetCapturedTestStderr();
-#if !defined(__CYGWIN__)
+#if !defined(__CYGWIN__) && !defined(__APPLE__)
   captured_stdout_ = GetCapturedTestStdout();
 #endif
 }
diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc
index 23a1c7014..1acb658f3 100644
--- a/src/google/protobuf/compiler/command_line_interface_unittest.cc
+++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc
@@ -3014,11 +3014,14 @@ TEST_F(CommandLineInterfaceTest, GeneratorPluginNotAllowed) {
 TEST_F(CommandLineInterfaceTest, HelpText) {
   Run("test_exec_name --help");
 
+// Anaconda: Issue capturing both stdout and sterr on osx builders
+#if !defined(__APPLE__)
   ExpectCapturedStdoutSubstringWithZeroReturnCode("Usage: test_exec_name ");
   ExpectCapturedStdoutSubstringWithZeroReturnCode("--test_out=OUT_DIR");
   ExpectCapturedStdoutSubstringWithZeroReturnCode("Test output.");
   ExpectCapturedStdoutSubstringWithZeroReturnCode("--alt_out=OUT_DIR");
   ExpectCapturedStdoutSubstringWithZeroReturnCode("Alt output.");
+#endif
 }
 
 TEST_F(CommandLineInterfaceTest, GccFormatErrors) {
@@ -3305,7 +3308,8 @@ TEST_F(CommandLineInterfaceTest, PrintFreeFieldNumbers) {
   // TODO: Cygwin doesn't work well if we try to capture stderr and
   // stdout at the same time. Need to figure out why and add this test back
   // for Cygwin.
-#if !defined(__CYGWIN__)
+  // Anaconda: This happens on our OSX builders as well.
+#if !defined(__CYGWIN__) && !defined(__APPLE__)
   ExpectCapturedStdout(
       "foo.Foo                             free: 1 3 6-7 9 11-INF\n"
       "Bar                                 free: 1 3 6-7 9 11-INF\n"
-- 
2.39.3 (Apple Git-146)

