docker-compose-rule icon indicating copy to clipboard operation
docker-compose-rule copied to clipboard

Feature/look in path

Open hpryce opened this issue 7 years ago • 4 comments

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.

hpryce avatar Mar 07 '17 16:03 hpryce

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.

hpryce avatar Mar 08 '17 16:03 hpryce

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!

samwright avatar Mar 08 '17 16:03 samwright

@hpryce , is this still relevant / needed to merge? Or is this overcome-by-events?

dotCipher avatar Apr 17 '18 19:04 dotCipher

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.

nedtwigg avatar Jul 10 '18 23:07 nedtwigg