Search in sources :

Example 56 with Executor

use of org.opensolaris.opengrok.util.Executor in project OpenGrok by OpenGrok.

the class MercurialRepositoryTest method runHgCommand.

/**
     * Run Mercurial command.
     *
     * @param command hg command to run
     * @param reposRoot directory of the repository root
     * @param arg argument to use for the command
     */
static void runHgCommand(String command, File reposRoot, String arg) {
    String[] cmdargs = { MercurialRepository.CMD_FALLBACK, command, arg };
    Executor exec = new Executor(Arrays.asList(cmdargs), reposRoot);
    int exitCode = exec.exec();
    if (exitCode != 0) {
        fail("hg " + command + " failed." + "\nexit code: " + exitCode + "\nstdout:\n" + exec.getOutputString() + "\nstderr:\n" + exec.getErrorString());
    }
}
Also used : Executor(org.opensolaris.opengrok.util.Executor)

Aggregations

Executor (org.opensolaris.opengrok.util.Executor)56 ArrayList (java.util.ArrayList)43 File (java.io.File)33 IOException (java.io.IOException)33 BufferedReader (java.io.BufferedReader)6 InputStream (java.io.InputStream)4 Properties (java.util.Properties)4 Matcher (java.util.regex.Matcher)4 BufferedInputStream (java.io.BufferedInputStream)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 Date (java.util.Date)2 RuntimeEnvironment (org.opensolaris.opengrok.configuration.RuntimeEnvironment)2 FileInputStream (java.io.FileInputStream)1 FileReader (java.io.FileReader)1 ParseException (java.text.ParseException)1 HashMap (java.util.HashMap)1 Scanner (java.util.Scanner)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1