1515 * Utility class for executing processes
1616 */
1717public class Execution {
18+
1819 /**
1920 * Execute a process in a working directory
2021 *
@@ -24,8 +25,11 @@ public class Execution {
2425 * @return the executed process
2526 * @throws IOException if an issue occurs executing the process
2627 */
27- public static ProcessExecution runProcess (File working , int timeout , String ... args )
28- throws IOException , TimeoutException {
28+ public static ProcessExecution runProcess (
29+ File working ,
30+ int timeout ,
31+ String ... args
32+ ) throws IOException , TimeoutException {
2933 ProcessBuilder builder = new ProcessBuilder (args );
3034 builder .directory (working );
3135
@@ -41,9 +45,11 @@ public static ProcessExecution runProcess(File working, int timeout, String... a
4145 * @return the executed process
4246 * @throws IOException if an issue occurs executing the process
4347 */
44- public static ProcessExecution runProcess (Map <String , String > environment ,
45- int timeout , String ... args )
46- throws IOException , TimeoutException {
48+ public static ProcessExecution runProcess (
49+ Map <String , String > environment ,
50+ int timeout ,
51+ String ... args
52+ ) throws IOException , TimeoutException {
4753 ProcessBuilder builder = new ProcessBuilder (args );
4854 builder .environment ().putAll (environment );
4955
@@ -60,9 +66,12 @@ public static ProcessExecution runProcess(Map<String, String> environment,
6066 * @return the executed process
6167 * @throws IOException if an issue occurs executing the process
6268 */
63- public static ProcessExecution runProcess (File working , Map <String , String > environment ,
64- int timeout , String ... args )
65- throws IOException , TimeoutException {
69+ public static ProcessExecution runProcess (
70+ File working ,
71+ Map <String , String > environment ,
72+ int timeout ,
73+ String ... args
74+ ) throws IOException , TimeoutException {
6675 ProcessBuilder builder = new ProcessBuilder (args );
6776 builder .directory (working );
6877 builder .environment ().putAll (environment );
@@ -74,7 +83,7 @@ public static ProcessExecution runProcess(File working, Map<String, String> envi
7483 * Helper to execute a process.
7584 */
7685 private static ProcessExecution run (ProcessBuilder builder , int timeout )
77- throws IOException , TimeoutException {
86+ throws IOException , TimeoutException {
7887 Process process ;
7988 ProcessExecution execution = new ProcessExecution ();
8089 try {
@@ -86,7 +95,9 @@ private static ProcessExecution run(ProcessBuilder builder, int timeout)
8695 @ Override
8796 public void run () {
8897 try {
89- InputStreamReader in = new InputStreamReader (process .getInputStream ());
98+ InputStreamReader in = new InputStreamReader (
99+ process .getInputStream ()
100+ );
90101 int bite ;
91102 while ((bite = in .read ()) != -1 ) {
92103 output .write (bite );
@@ -100,7 +111,9 @@ public void run() {
100111 @ Override
101112 public void run () {
102113 try {
103- InputStreamReader in = new InputStreamReader (process .getErrorStream ());
114+ InputStreamReader in = new InputStreamReader (
115+ process .getErrorStream ()
116+ );
104117 int bite ;
105118 while ((bite = in .read ()) != -1 ) {
106119 error .write (bite );
@@ -141,7 +154,7 @@ public void run() {
141154 * @throws IOException if an issue occurs executing the process
142155 */
143156 public static ProcessExecution runProcess (int timeout , String ... args )
144- throws IOException , TimeoutException {
157+ throws IOException , TimeoutException {
145158 return runProcess (new File ("." ), timeout , args );
146159 }
147160
0 commit comments