docker-compose-rule
docker-compose-rule copied to clipboard
Feature/look in path
This combines https://github.com/palantir/docker-compose-rule/pull/170 and https://github.com/palantir/docker-compose-rule/pull/152 to provide support for finding docker from the path both on Windows and in existing setups.
Okay, it turns out ProcessBuilder looks for commands on the path (at least on Mac/Linux) and so there is no need to do this manually. I've updated the PR to do the simpler thing of only looking in the known Mac install locations and allow for explicitly setting it through an environment variable.
@samwright could you give this a spin and see if it is actually sufficient for Windows? If not we should find a library that will give us as because as @chrisalice pointed out the Windows path variable can contain expansions that would require us to look at other environment variables to correctly use.
Yep this works in Windows. I also tried just running "docker-compose.exe" without specifying its location and that worked too:
ProcessBuilder pb = new ProcessBuilder("docker-compose.exe", "-v");
Process p = pb.start();
p.waitFor();
BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream(), StandardCharsets.UTF_8));
System.out.println(r.lines().collect(Collectors.toList())); // Prints: docker-compose version 1.11.2, build f963d76f
So it would probably be best to get rid of all that path variable stuff. Sorry for giving you a red herring!
@hpryce , is this still relevant / needed to merge? Or is this overcome-by-events?
On windows, the just-released 0.34.0
is giving me Could not find docker-compose
, even though docker-compose.exe
is right on the path. Seems like this PR would fix it.