Skip to content

Commit

Permalink
DCA11Y-1145: debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
flipatlas committed Sep 19, 2024
1 parent acbed65 commit 628271a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ private List<String> getShellCommand(List<String> command) {
List<String> profiledShellCommand = new ArrayList<>();
profiledShellCommand.add(getCurrentShell());
profiledShellCommand.add("--login");
profiledShellCommand.add("--rcfile");
profiledShellCommand.add("~/.bash_profile");
profiledShellCommand.add("-c");
profiledShellCommand.add(String.join(" ", command));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ public VersionManagerLocator(InstallConfig installConfig) {
}

public VersionManagerType findAvailable() {
shellExecutor.execute(Arrays.asList("echo", "$HOME"));
shellExecutor.execute(Arrays.asList("echo", "~"));
shellExecutor.execute(Arrays.asList("ls", "-a"));
shellExecutor.execute(Arrays.asList("ls", "-l", ".bash_profile"));

for (VersionManagerType versionManagerType : VersionManagerType.values()) {
if(isVersionManagerLoaded(versionManagerType.getExecutable())) return versionManagerType;
}
return null;
}

private boolean isVersionManagerLoaded(String executable) {
shellExecutor.execute(Arrays.asList("echo", "$HOME"));
shellExecutor.execute(Arrays.asList("echo", "~"));
shellExecutor.execute(Arrays.asList("ls", "-a"));
shellExecutor.execute(Arrays.asList("ls", "-l", ".bash_profile"));

String result = shellExecutor.execute(Arrays.asList("command", "-v", executable));
if (!result.isEmpty()) {
// needed to mock out version managers in tests
Expand Down

0 comments on commit 628271a

Please sign in to comment.