use of com.google.copybara.shell.CommandException in project copybara by google.
the class QuiltTransformationTest method setUpQuiltBin.
// Returns "quilt" if the "quilt" command can execute successfully. Otherwise, returns the path
// to the quilt binary from build-time data dependency.
private static String setUpQuiltBin(GeneralOptions options) {
// Try executing "quilt --version" to see if "quilt" command can run.
Command cmd = new Command(new String[] { "quilt", "--version" }, options.getEnvironment(), null);
boolean success = false;
try {
options.newCommandRunner(cmd).execute();
success = true;
} catch (CommandException e) {
// "success" remains false.
}
if (success) {
return "quilt";
}
Path runtime = Paths.get(System.getenv("TEST_SRCDIR")).resolve(System.getenv("TEST_WORKSPACE")).resolve("third_party/quilt");
return runtime.resolve("quilt").toAbsolutePath().toString();
}
Aggregations