Skip to content
This repository was archived by the owner on Dec 3, 2023. It is now read-only.

Commit 9545442

Browse files
authored
fix: fix gcloud SDK detection on Windows (#384)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/java-core/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #383
1 parent 82840da commit 9545442

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

google-cloud-core/src/main/java/com/google/cloud/testing/BaseEmulatorHelper.java

+2-8
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import java.util.Arrays;
4848
import java.util.List;
4949
import java.util.Locale;
50-
import java.util.Map;
5150
import java.util.concurrent.Callable;
5251
import java.util.concurrent.ExecutionException;
5352
import java.util.concurrent.TimeUnit;
@@ -275,13 +274,8 @@ public Process getProcess() {
275274
}
276275

277276
private boolean isGcloudInstalled() {
278-
Map<String, String> env = System.getenv();
279-
for (String envName : env.keySet()) {
280-
if ("PATH".equals(envName)) {
281-
return env.get(envName).contains("google-cloud-sdk");
282-
}
283-
}
284-
return false;
277+
String path = System.getenv("PATH");
278+
return path != null && path.contains("google-cloud-sdk");
285279
}
286280

287281
private boolean isEmulatorUpToDate() throws IOException, InterruptedException {

0 commit comments

Comments
 (0)