Skip to content

Commit f74ccaa

Browse files
dmlloydgsmet
authored andcommitted
Do not capture the output streams when start/stopping the Gradle daemon in tests, since nothing would ever be captured anyway
1 parent a15abf8 commit f74ccaa

File tree

1 file changed

+13
-30
lines changed

1 file changed

+13
-30
lines changed

devtools/cli/src/test/java/io/quarkus/cli/CliDriver.java

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -156,37 +156,20 @@ public static Result executeArbitraryCommand(Path startingDir, String... args) {
156156

157157
Result result = new Result();
158158

159-
ByteArrayOutputStream out = new ByteArrayOutputStream();
160-
PrintStream outPs = new PrintStream(out);
161-
System.setOut(outPs);
162-
163-
ByteArrayOutputStream err = new ByteArrayOutputStream();
164-
PrintStream errPs = new PrintStream(err);
165-
System.setErr(errPs);
166-
167-
try {
168-
io.smallrye.common.process.ProcessBuilder.newBuilder(Path.of(args[0]))
169-
.arguments(Arrays.copyOfRange(args, 1, args.length))
170-
.exitCodeChecker(ec -> {
171-
result.exitCode = ec;
172-
return true;
173-
})
174-
.directory(startingDir)
175-
// since there is no I/O, we need an explicit timeout
176-
.softExitTimeout(Duration.ofMinutes(5))
177-
.hardExitTimeout(Duration.ofMinutes(5))
178-
.output().inherited()
179-
.error().logOnSuccess(false).gatherOnFail(false).inherited()
180-
.run();
181-
} finally {
182-
outPs.flush();
183-
errPs.flush();
184-
System.setOut(stdout);
185-
System.setErr(stderr);
186-
}
159+
io.smallrye.common.process.ProcessBuilder.newBuilder(Path.of(args[0]))
160+
.arguments(Arrays.copyOfRange(args, 1, args.length))
161+
.exitCodeChecker(ec -> {
162+
result.exitCode = ec;
163+
return true;
164+
})
165+
.directory(startingDir)
166+
// since there is no I/O, we need an explicit timeout
167+
.softExitTimeout(Duration.ofMinutes(5))
168+
.hardExitTimeout(Duration.ofMinutes(5))
169+
.output().inherited()
170+
.error().logOnSuccess(false).gatherOnFail(false).inherited()
171+
.run();
187172

188-
result.stdout = out.toString();
189-
result.stderr = err.toString();
190173
return result;
191174
}
192175

0 commit comments

Comments
 (0)