Skip to content

Commit

Permalink
Fix docker-compose executable check for Win10 (testcontainers#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan committed Sep 21, 2017
1 parent 6c8fb1b commit 61d9b0e
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.google.common.collect.Maps;
import com.google.common.util.concurrent.Uninterruptibles;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.SystemUtils;
import org.junit.runner.Description;
import org.rnorth.ducttape.ratelimits.RateLimiter;
import org.rnorth.ducttape.ratelimits.RateLimiterBuilder;
Expand Down Expand Up @@ -493,7 +494,7 @@ public DockerCompose withEnv(Map<String, String> env) {
@Override
public void invoke() {
// bail out early
if (!CommandLine.executableExists(COMPOSE_EXECUTABLE)) {
if (!isDockerComposeExists()) {
throw new ContainerLaunchException("Local Docker Compose not found. Is " + COMPOSE_EXECUTABLE + " on the PATH?");
}

Expand Down Expand Up @@ -530,6 +531,17 @@ public void invoke() {
}
}

// #460 : docker-compose are not resolvable on Win10 machines because there is docker-compose.exe binary,
// but not docker-compose
private boolean isDockerComposeExists() {
boolean dockerComposeExists = CommandLine.executableExists(COMPOSE_EXECUTABLE);
if (!dockerComposeExists && SystemUtils.IS_OS_WINDOWS) {
return CommandLine.executableExists(COMPOSE_EXECUTABLE + ".exe");
}

return dockerComposeExists;
}

/**
* @return a logger
*/
Expand Down

0 comments on commit 61d9b0e

Please sign in to comment.