diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 4e54f3ed6f..fb2a4e56c9 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -20,6 +20,7 @@ Release with new features and bugfixes: * https://github.com/devonfw/IDEasy/issues/1853[#1853]: Add ARM releases for VSCode on Mac * https://github.com/devonfw/IDEasy/issues/797[#797]: Use system unzip on macOS to preserve symlinks in ZIP extraction * https://github.com/devonfw/IDEasy/issues/1723[#1723]: Add commandlet for GitHub Copilot CLI +* https://github.com/devonfw/IDEasy/issues/861[#861]: Fix install of pgadmin throws IllegalStateException when the install wizard starts * https://github.com/devonfw/IDEasy/issues/1685[#1685]: Add Nest CLI to IDEasy commandlets The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/44?closed=1[milestone 2026.05.001]. diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/GlobalToolCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/GlobalToolCommandlet.java index 95c520a3b6..920c0eae48 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/GlobalToolCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/GlobalToolCommandlet.java @@ -159,7 +159,7 @@ protected ToolInstallation doInstall(ToolInstallRequest request) { executable = fileAccess.findFirst(downloadBinaryPath, Files::isExecutable, false); } ProcessContext pc = this.context.newProcess().errorHandling(ProcessErrorHandling.LOG_WARNING).executable(executable); - int exitCode = pc.run(ProcessMode.BACKGROUND).getExitCode(); + int exitCode = pc.run(ProcessMode.BACKGROUND_SILENT).getExitCode(); if (tmpDir != null) { fileAccess.delete(tmpDir); } @@ -174,7 +174,8 @@ protected ToolInstallation doInstall(ToolInstallRequest request) { } installationPath = getInstallationPath(toolEdition.edition(), resolvedVersion); if (installationPath == null) { - LOG.warn("Could not find binary {} on PATH after installation.", getBinaryName()); + throw new CliException("The tool " + this.tool + " is about to be installed. Please complete the installation and if required " + + "reboot your machine. Then rerun the command to start the tool.", 2); } return createToolInstallation(installationPath, resolvedVersion, true, pc, false); } diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/pgadmin/PgAdmin.java b/cli/src/main/java/com/devonfw/tools/ide/tool/pgadmin/PgAdmin.java index 46e1499497..9652701931 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/pgadmin/PgAdmin.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/pgadmin/PgAdmin.java @@ -1,5 +1,8 @@ package com.devonfw.tools.ide.tool.pgadmin; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -7,6 +10,7 @@ import com.devonfw.tools.ide.common.Tag; import com.devonfw.tools.ide.context.IdeContext; +import com.devonfw.tools.ide.os.WindowsHelper; import com.devonfw.tools.ide.tool.GlobalToolCommandlet; import com.devonfw.tools.ide.tool.NativePackageManager; import com.devonfw.tools.ide.tool.PackageManagerCommand; @@ -72,4 +76,30 @@ protected String getBinaryName() { return "pgadmin4"; } + + @Override + protected Path getInstallationPath(String edition, VersionIdentifier resolvedVersion) { + if (super.getInstallationPath(edition, resolvedVersion) == null) { + if (this.context.getSystemInfo().isWindows()) { + return getExecutableFolderFromWindowsRegistry(); + } + } + return null; + } + + private Path getExecutableFolderFromWindowsRegistry() { + + WindowsHelper windowsHelper = WindowsHelper.get(this.context); + String registryPath = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\pgAdmin 4v9_is1"; + String displayIcon = windowsHelper.getRegistryValue(registryPath, "DisplayIcon"); + if (displayIcon != null) { + Path executablePath = Paths.get(displayIcon); + if (Files.isExecutable(executablePath)) { + Path installationDir = executablePath.getParent(); + this.context.getPath().setPath(getName(), installationDir); + return installationDir; + } + } + return null; + } }