Skip to content

Commit 4be41ff

Browse files
Add compatibility with latest process mode
1 parent 31b7caa commit 4be41ff

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

cli/src/main/java/com/devonfw/tools/ide/process/ProcessContextImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ public ProcessResult run(ProcessMode processMode) {
109109
this.processBuilder.redirectOutput(Redirect.INHERIT).redirectError(Redirect.INHERIT);
110110
}
111111

112+
if (processMode == ProcessMode.DEFAULT_SILENT) {
113+
this.processBuilder.redirectOutput(Redirect.DISCARD).redirectError(Redirect.DISCARD);
114+
}
115+
112116
if (this.executable == null) {
113117
throw new IllegalStateException("Missing executable to run process!");
114118
}

cli/src/main/java/com/devonfw/tools/ide/process/ProcessMode.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ public enum ProcessMode {
3333
* parent process. This setting makes the child process dependant from the parent process! (If you close the parent
3434
* process the child process will also be terminated.)
3535
*/
36-
DEFAULT_CAPTURE;
36+
DEFAULT_CAPTURE,
37+
38+
/**
39+
* Like {@link #DEFAULT} the parent and child process will not be detached, the subprocess output will be discarded
40+
* (to the operating system "null file" ) using {@link ProcessBuilder.Redirect#DISCARD}.
41+
*/
42+
DEFAULT_SILENT;
3743

3844
/**
3945
* Method to check if the ProcessMode is a background process.

cli/src/main/java/com/devonfw/tools/ide/tool/dotnet/DotNet.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.devonfw.tools.ide.io.FileAccess;
1111
import com.devonfw.tools.ide.process.ProcessContext;
1212
import com.devonfw.tools.ide.process.ProcessErrorHandling;
13+
import com.devonfw.tools.ide.process.ProcessMode;
1314
import com.devonfw.tools.ide.tool.LocalToolCommandlet;
1415

1516
public class DotNet extends LocalToolCommandlet {
@@ -41,9 +42,9 @@ public void run() {
4142
}
4243

4344
if (context.isQuietMode()) {
44-
runTool(null, true, args);
45+
runTool(ProcessMode.DEFAULT_SILENT, null, args);
4546
} else {
46-
runTool(false, null, args);
47+
runTool(ProcessMode.DEFAULT, null, args);
4748
}
4849
}
4950

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

82-
pc.run(false, false);
83+
pc.run(ProcessMode.DEFAULT);
8384

8485
}
8586

0 commit comments

Comments
 (0)