From 7ca32186f8874b8d247fc09d87b5518706311078 Mon Sep 17 00:00:00 2001 From: Kevin Wise Date: Tue, 23 Feb 2021 16:13:16 -0700 Subject: [PATCH] fix: fix GCloud detection on Windows --- .../com/google/cloud/testing/BaseEmulatorHelper.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/google-cloud-core/src/main/java/com/google/cloud/testing/BaseEmulatorHelper.java b/google-cloud-core/src/main/java/com/google/cloud/testing/BaseEmulatorHelper.java index 00291f2b4b..9a0898960a 100644 --- a/google-cloud-core/src/main/java/com/google/cloud/testing/BaseEmulatorHelper.java +++ b/google-cloud-core/src/main/java/com/google/cloud/testing/BaseEmulatorHelper.java @@ -47,7 +47,6 @@ import java.util.Arrays; import java.util.List; import java.util.Locale; -import java.util.Map; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; @@ -275,13 +274,8 @@ public Process getProcess() { } private boolean isGcloudInstalled() { - Map env = System.getenv(); - for (String envName : env.keySet()) { - if ("PATH".equals(envName)) { - return env.get(envName).contains("google-cloud-sdk"); - } - } - return false; + String path = System.getenv("PATH"); + return path != null && path.contains("google-cloud-sdk"); } private boolean isEmulatorUpToDate() throws IOException, InterruptedException {