From 628271a3d84ecc6dcdb33ec873cfef0f560830f4 Mon Sep 17 00:00:00 2001 From: fnowakowski Date: Thu, 19 Sep 2024 10:08:48 +0200 Subject: [PATCH] DCA11Y-1145: debug logs --- .../frontend/lib/version/manager/ShellExecutor.java | 2 ++ .../lib/version/manager/VersionManagerLocator.java | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/version/manager/ShellExecutor.java b/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/version/manager/ShellExecutor.java index 3093e512b..763dc28e3 100644 --- a/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/version/manager/ShellExecutor.java +++ b/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/version/manager/ShellExecutor.java @@ -59,6 +59,8 @@ private List getShellCommand(List command) { List profiledShellCommand = new ArrayList<>(); profiledShellCommand.add(getCurrentShell()); profiledShellCommand.add("--login"); + profiledShellCommand.add("--rcfile"); + profiledShellCommand.add("~/.bash_profile"); profiledShellCommand.add("-c"); profiledShellCommand.add(String.join(" ", command)); diff --git a/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/version/manager/VersionManagerLocator.java b/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/version/manager/VersionManagerLocator.java index d454b120b..146118ce6 100644 --- a/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/version/manager/VersionManagerLocator.java +++ b/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/version/manager/VersionManagerLocator.java @@ -13,6 +13,11 @@ 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; } @@ -20,11 +25,6 @@ public VersionManagerType findAvailable() { } 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