Skip to content

Commit

Permalink
#1093: do not fail on remove of variable if not defined (#1094)
Browse files Browse the repository at this point in the history
  • Loading branch information
hohwille authored Feb 27, 2025
1 parent df2cda5 commit b327bab
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.log.IdeLogLevel;
import com.devonfw.tools.ide.process.ProcessErrorHandling;
import com.devonfw.tools.ide.process.ProcessMode;
import com.devonfw.tools.ide.process.ProcessResult;

Expand Down Expand Up @@ -36,7 +37,8 @@ public void setUserEnvironmentValue(String key, String value) {

@Override
public void removeUserEnvironmentValue(String key) {
ProcessResult result = this.context.newProcess().executable("reg").addArgs("delete", HKCU_ENVIRONMENT, "/v", key, "/f").run(ProcessMode.DEFAULT_CAPTURE);
ProcessResult result = this.context.newProcess().executable("reg").addArgs("delete", HKCU_ENVIRONMENT, "/v", key, "/f")
.errorHandling(ProcessErrorHandling.LOG_WARNING).run(ProcessMode.DEFAULT_CAPTURE);
if (result.isSuccessful()) {
this.context.debug("Removed environment variable {}", key);
} else {
Expand Down

0 comments on commit b327bab

Please sign in to comment.