@@ -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