Command extends Thread { public static String execLine(File workingDir, String command) { return exec(false, workingDir, tokenize(command)); } 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 testCommandReturn() { String cmd = FileUtils.isOsWindows() ? "cmd /c dir" : "ls"; String result = Command.execLine(new File("target"), cmd); assertTrue(result.contains("karate")); }