Skip to content

Commit

Permalink
Fix getting env variables on windows (#15518)
Browse files Browse the repository at this point in the history
Fixes #15436

Closes #15518

COPYBARA_INTEGRATE_REVIEW=#15518 from isuruf:win_env 1b1f2cc
PiperOrigin-RevId: 600469988
  • Loading branch information
isuruf authored and copybara-github committed Jan 22, 2024
1 parent 0f4cf16 commit 71b0b4e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/google/protobuf/compiler/mock_code_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ static constexpr absl::string_view kSecondInsertionPoint =
" # @@protoc_insertion_point(second_mock_insertion_point) is here\n";

MockCodeGenerator::MockCodeGenerator(absl::string_view name) : name_(name) {
absl::string_view key = getenv("TEST_CASE");
const char* c_key = getenv("TEST_CASE");
if (c_key == NULL) {
// In Windows, setting 'TEST_CASE=' is equivalent to unsetting
// and therefore c_key can be NULL
c_key = "";
}
absl::string_view key(c_key);
if (key == "no_editions") {
suppressed_features_ |= CodeGenerator::FEATURE_SUPPORTS_EDITIONS;
} else if (key == "invalid_features") {
Expand Down

0 comments on commit 71b0b4e

Please sign in to comment.