Command extends Thread { public Command(String... args) { this(false, null, null, null, null, args); } Command(String... args);  Command(boolean useLineFeed, File workingDir, String... args);  Command(boolean useLineFeed, Logger logger, String uniqueName, String logFile, File workingDir, String... args); boolean isFailed(); Exception getFailureReason(); void setEnvironment(Map<String, String> environment); void setListener(Consumer<String> listener); void setErrorListener(Consumer<String> errorListener); void setRedirectErrorStream(boolean redirectErrorStream); String getSysOut(); String getSysErr(); static String exec(boolean useLineFeed, File workingDir, String... args); static String[] tokenize(String command); static String execLine(File workingDir, String command); static String getBuildDir(); static synchronized int getFreePort(int preferred); static boolean waitForPort(String host, int port); static boolean waitForHttp(String url); static boolean waitForSocket(int port); Map<String, String> getEnvironment(); File getWorkingDir(); List getArgList(); Logger getLogger(); LogAppender getAppender(); String getUniqueName(); int getExitCode(); int waitSync(); void close(boolean force); @Override void run();  }
@Test public void testCommand() { String cmd = FileUtils.isOsWindows() ? "print \"hello\"" : "ls"; Command command = new Command(false, null, null, "target/command.log", new File("src"), cmd, "-al"); command.start(); int exitCode = command.waitSync(); assertEquals(exitCode, 0); }