Skip to content

Commit

Permalink
Add compatibility with latest process mode
Browse files Browse the repository at this point in the history
  • Loading branch information
MustaphaOuchen committed Mar 1, 2024
1 parent 31b7caa commit 4be41ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ public ProcessResult run(ProcessMode processMode) {
this.processBuilder.redirectOutput(Redirect.INHERIT).redirectError(Redirect.INHERIT);
}

if (processMode == ProcessMode.DEFAULT_SILENT) {
this.processBuilder.redirectOutput(Redirect.DISCARD).redirectError(Redirect.DISCARD);
}

if (this.executable == null) {
throw new IllegalStateException("Missing executable to run process!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ public enum ProcessMode {
* parent process. This setting makes the child process dependant from the parent process! (If you close the parent
* process the child process will also be terminated.)
*/
DEFAULT_CAPTURE;
DEFAULT_CAPTURE,

/**
* Like {@link #DEFAULT} the parent and child process will not be detached, the subprocess output will be discarded
* (to the operating system "null file" ) using {@link ProcessBuilder.Redirect#DISCARD}.
*/
DEFAULT_SILENT;

/**
* Method to check if the ProcessMode is a background process.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.devonfw.tools.ide.io.FileAccess;
import com.devonfw.tools.ide.process.ProcessContext;
import com.devonfw.tools.ide.process.ProcessErrorHandling;
import com.devonfw.tools.ide.process.ProcessMode;
import com.devonfw.tools.ide.tool.LocalToolCommandlet;

public class DotNet extends LocalToolCommandlet {
Expand Down Expand Up @@ -41,9 +42,9 @@ public void run() {
}

if (context.isQuietMode()) {
runTool(null, true, args);
runTool(ProcessMode.DEFAULT_SILENT, null, args);
} else {
runTool(false, null, args);
runTool(ProcessMode.DEFAULT, null, args);
}
}

Expand Down Expand Up @@ -79,7 +80,7 @@ private void installDevon4NetTemplate() {
ProcessContext pc = this.context.newProcess().errorHandling(ProcessErrorHandling.WARNING).executable(binaryPath)
.addArgs(args);

pc.run(false, false);
pc.run(ProcessMode.DEFAULT);

}

Expand Down

0 comments on commit 4be41ff

Please sign in to comment.