Skip to content

Commit 91d7e17

Browse files
author
Jonathan Beaudoin
committed
Added new Utils class for various methods
1 parent b6247d5 commit 91d7e17

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.beaudoin.jmm.misc;
2+
3+
import java.io.IOException;
4+
import java.util.Arrays;
5+
import java.util.Scanner;
6+
7+
/**
8+
* Created by Jonathan on 1/11/16.
9+
*/
10+
public final class Utils {
11+
12+
public static int exec(String... command) {
13+
try {
14+
return Integer.parseInt(new Scanner(Runtime.getRuntime().exec(command).getInputStream()).next());
15+
} catch (IOException e) {
16+
throw new RuntimeException("Failed to read output from " + Arrays.toString(command));
17+
}
18+
}
19+
20+
}

0 commit comments

Comments
 (0)