- /**
- * Just to test the environment / stdout are working correctly
- */
- public static void main(String[] args) {
- List<String> command = Arrays.asList("ls", "-l");
- executeCommand(command);
- }
-
- private static boolean executeCommand(List<String> command) {
- try {
- ProcessBuilder builder = new ProcessBuilder(command);
- builder.redirectErrorStream(true);
- builder.redirectOutput(Redirect.INHERIT);
-
- Process p = builder.start();
- int ret = p.waitFor();
- return (ret == 0);
-
- } catch (IOException | InterruptedException e) {
- return false;
- }
- }