Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#415: log command before sudo pw #732

Merged
merged 9 commits into from
Nov 11, 2024
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This file documents all notable changes to https://github.com/devonfw/IDEasy[IDE

Release with new features and bugfixes:

* https://github.com/devonfw/IDEasy/issues/415[#415]: Added a message that will inform the user for what process he will need to enter his sudo- password
* https://github.com/devonfw/IDEasy/issues/708[#708]: Open vscode in workspace path
* https://github.com/devonfw/IDEasy/issues/608[#608]: Enhanced error messages. Now logs missing command output and error messages
* https://github.com/devonfw/IDEasy/issues/715[#715]: Show "cygwin is not supported" message for cygwin users
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ protected boolean runWithPackageManager(boolean silent, List<PackageManagerComma
return false; // None of the package manager commands were successful
}

private void logPackageManagerCommands(PackageManagerCommand pmCommand) {

this.context.interaction("We need to run the following privileged command(s):");
for (String command : pmCommand.commands()) {
this.context.interaction(command);
}
this.context.interaction("This will require root permissions!");
}

/**
* Executes the provided package manager command.
*
Expand All @@ -80,6 +89,7 @@ protected boolean runWithPackageManager(boolean silent, List<PackageManagerComma
private boolean executePackageManagerCommand(PackageManagerCommand pmCommand, boolean silent) {

String bashPath = this.context.findBashRequired();
logPackageManagerCommands(pmCommand);
for (String command : pmCommand.commands()) {
ProcessContext pc = this.context.newProcess().errorHandling(ProcessErrorHandling.LOG_WARNING).executable(bashPath)
.addArgs("-c", command);
Expand Down
Loading