@@ -29,33 +29,31 @@ public static int run(String scriptPath, String... args)
2929 pb .redirectErrorStream (false );
3030 Process process = pb .start ();
3131
32- // Stream stdout
32+ // Drain stdout (suppress console output)
3333 Thread stdoutThread =
3434 new Thread (
3535 () -> {
3636 try (BufferedReader reader =
3737 new BufferedReader (new InputStreamReader (process .getInputStream ()))) {
38- String line ;
39- while ((line = reader .readLine ()) != null ) {
40- System .out .println ("[script] " + line );
38+ while (reader .readLine () != null ) {
39+ // discard
4140 }
4241 } catch (IOException e ) {
43- System . err . println ( "Error reading script stdout: " + e . getMessage ());
42+ // ignore
4443 }
4544 });
4645
47- // Stream stderr
46+ // Drain stderr (suppress console output)
4847 Thread stderrThread =
4948 new Thread (
5049 () -> {
5150 try (BufferedReader reader =
5251 new BufferedReader (new InputStreamReader (process .getErrorStream ()))) {
53- String line ;
54- while ((line = reader .readLine ()) != null ) {
55- System .err .println ("[script-err] " + line );
52+ while (reader .readLine () != null ) {
53+ // discard
5654 }
5755 } catch (IOException e ) {
58- System . err . println ( "Error reading script stderr: " + e . getMessage ());
56+ // ignore
5957 }
6058 });
6159
@@ -107,12 +105,11 @@ public static String runAndCaptureOutput(String scriptPath, String... args)
107105 () -> {
108106 try (BufferedReader reader =
109107 new BufferedReader (new InputStreamReader (process .getErrorStream ()))) {
110- String line ;
111- while ((line = reader .readLine ()) != null ) {
112- System .err .println ("[script-err] " + line );
108+ while (reader .readLine () != null ) {
109+ // discard
113110 }
114111 } catch (IOException e ) {
115- System . err . println ( "Error reading script stderr: " + e . getMessage ());
112+ // ignore
116113 }
117114 });
118115
@@ -156,11 +153,10 @@ public static Result runAndCaptureAll(String scriptPath, String... args)
156153 new BufferedReader (new InputStreamReader (process .getInputStream ()))) {
157154 String line ;
158155 while ((line = reader .readLine ()) != null ) {
159- System .out .println ("[script] " + line );
160156 stdoutLines .add (line );
161157 }
162158 } catch (IOException e ) {
163- System . err . println ( "Error reading script stdout: " + e . getMessage ());
159+ // ignore
164160 }
165161 });
166162
@@ -169,12 +165,11 @@ public static Result runAndCaptureAll(String scriptPath, String... args)
169165 () -> {
170166 try (BufferedReader reader =
171167 new BufferedReader (new InputStreamReader (process .getErrorStream ()))) {
172- String line ;
173- while ((line = reader .readLine ()) != null ) {
174- System .err .println ("[script-err] " + line );
168+ while (reader .readLine () != null ) {
169+ // discard
175170 }
176171 } catch (IOException e ) {
177- System . err . println ( "Error reading script stderr: " + e . getMessage ());
172+ // ignore
178173 }
179174 });
180175
0 commit comments