@Test public void runProcess_PerformsAsExpected_OnSuccessfulCommandExecution() throws IOException { Path tempDir = Paths.get(System.getProperty("java.io.tmpdir"), File.separator, "test"); ProcessRunner.run("mkdir", tempDir.toString()).run(); boolean runningOnWindows = runningOnWindows(); String[] command = runningOnWindows ? new String[] {"dir", tempDir.toString()} : new String[] {"ls", "-la", tempDir.toString()}; ProcessRunner.ExecutionResult executionResult = ProcessRunner.run(command).bufferOutput(true).runAndWait(); assertEquals(executionResult.getExitCode(), 0); assertTrue(executionResult.getBufferedStandardError().isEmpty()); if (runningOnWindows) { assertTrue(executionResult.getBufferedStandardOutput().isEmpty()); } else { assertEquals("total 0", executionResult.getBufferedStandardOutput().get(0)); } }
public static ExecutionBuilder run(String... command) { return new ExecutionBuilder(new ProcessBuilder().command(command)); }
ProcessRunner { public static ExecutionBuilder run(String... command) { return new ExecutionBuilder(new ProcessBuilder().command(command)); } }
ProcessRunner { public static ExecutionBuilder run(String... command) { return new ExecutionBuilder(new ProcessBuilder().command(command)); }  }
ProcessRunner { public static ExecutionBuilder run(String... command) { return new ExecutionBuilder(new ProcessBuilder().command(command)); }  static ExecutionBuilder run(String... command); }
ProcessRunner { public static ExecutionBuilder run(String... command) { return new ExecutionBuilder(new ProcessBuilder().command(command)); }  static ExecutionBuilder run(String... command);  }