Skip to content

Global tools run tool while installation is running in background #1659

Description

@hohwille

Actual behavior

When I run a global tool e.g. ide docker ps that is not yet installed, then the following is happening:
runTool is invoked that calls install method to ensure the tool is installed.
Since the tool is not installed and it is a global tool this typically means that we run an interactive installer in the background. In our example on Windows this would download e.g. the rancher desktop Windows installer and run it in the background showing me some first screen of the installer.
Since then the install method returns, we continue with runTool to execute the actual command which here is docker ps.
This will end up with an error since the docker command is not found (installation is still running).
Even after the installation is completed, the command docker would still be unavailable since the PATH was changed in the Windows registry and that change is not visible in my existing change.

docker: command not found

Reproduce

ide docker ps

Expected behavior

After docker installer is launched in the background, we should get the following warning logged:

The installation of docker/rancher@1.21.0[*] is currently running in the background!
You need to complete the installation, potentially reboot and rerun your 'ide' command in a new terminal session after the installation has completed.

IDEasy status

IDE_ROOT is set to D:/projects
IDE_HOME is set to D:/projects/project
You are online.
Found bash executable at: C:/Program Files/Git/usr/bin/bash.exe
Found git executable at: C:/Program Files/Git/mingw64/bin/git.exe
Your settings are up-to-date.
Your version of IDEasy is 2025.11.001.

Related/Dependent issues

#47

Comments/Hints

When we create a global installation by running an installer in the background here:

ProcessContext pc = this.context.newProcess().errorHandling(ProcessErrorHandling.LOG_WARNING).executable(executable);
int exitCode = pc.run(ProcessMode.BACKGROUND).getExitCode();
if (tmpDir != null) {
fileAccess.delete(tmpDir);
}
if (exitCode == 0) {
asSuccess(request.getStep()).log("Installation process for {} in version {} has started", this.tool, resolvedVersion);
} else {
throw new CliException("Installation process for " + this.tool + " in version " + resolvedVersion + " failed with exit code " + exitCode + "!");
}
installationPath = getInstallationPath(toolEdition.edition(), resolvedVersion);
if (installationPath == null) {
this.context.warning("Could not find binary {} on PATH after installation.", getBinaryName());
}
return createToolInstallation(installationPath, resolvedVersion, true, pc, false);

We should somehow have a new flag in ToolInstallation telling us that we have a background installation is running or in other words that the tool is not yet available. This flag should be set here to true while it is false by default (in all other places also in cases when we install a global tool via package manager on Linux since that will be synchronous waiting for the installation to complete).
Now we can change this code:

So we store the returned ToolInstallation in a local installation variable and check the new flag.
If that flag is true, we log a warning and abort the further process:

ToolInstallation installation = install(request);
if (installation.isInstalledAsynchronously()) {
  this.context.warning("The installation of {} is currently running in the background!\nYou need to complete the installation, potentially reboot and rerun your 'ide' command in a new terminal session after the installation has completed.", request.getRequested());
  return new ProcessResultImpl(this.tool, this.tool, 0, List.of());
}

Metadata

Metadata

Labels

dockerdocker and esp. DockerDesktopinstallinstallation process of IDE + tools and install commandletkubectlkubernetes command integrationready-to-implement

Type

Fields

No fields configured for Bug.

Projects

Status
🏗 In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions