@Test public void testExec_1() throws Exception { String command = "ls"; int result = CommandExecutor.exec(command); assertEquals(0, result); }
public static int exec(String command, OutputStream out, OutputStream err) throws IOException, InterruptedException { CommandLine cmdLine = CommandLine.parse(command); Executor executor = new DefaultExecutor(); executor.setStreamHandler(new PumpStreamHandler(out, err, null)); return executor.execute(cmdLine); }
CommandExecutor { public static int exec(String command, OutputStream out, OutputStream err) throws IOException, InterruptedException { CommandLine cmdLine = CommandLine.parse(command); Executor executor = new DefaultExecutor(); executor.setStreamHandler(new PumpStreamHandler(out, err, null)); return executor.execute(cmdLine); } }
CommandExecutor { public static int exec(String command, OutputStream out, OutputStream err) throws IOException, InterruptedException { CommandLine cmdLine = CommandLine.parse(command); Executor executor = new DefaultExecutor(); executor.setStreamHandler(new PumpStreamHandler(out, err, null)); return executor.execute(cmdLine); }  }
CommandExecutor { public static int exec(String command, OutputStream out, OutputStream err) throws IOException, InterruptedException { CommandLine cmdLine = CommandLine.parse(command); Executor executor = new DefaultExecutor(); executor.setStreamHandler(new PumpStreamHandler(out, err, null)); return executor.execute(cmdLine); }  static int exec(String command, OutputStream out, OutputStream err); static int exec(String command); }
CommandExecutor { public static int exec(String command, OutputStream out, OutputStream err) throws IOException, InterruptedException { CommandLine cmdLine = CommandLine.parse(command); Executor executor = new DefaultExecutor(); executor.setStreamHandler(new PumpStreamHandler(out, err, null)); return executor.execute(cmdLine); }  static int exec(String command, OutputStream out, OutputStream err); static int exec(String command);  }