Refine search
/** * Execute the given command are return success or failure * @param cmd command line to execute * @return the exit status of the subprocess or <code>INVALID</code> */ protected int run(Commandline cmd) { try { Project aProj = getProject(); Execute exe = new Execute( new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN)); exe.setAntRun(aProj); exe.setWorkingDirectory(aProj.getBaseDir()); exe.setCommandline(cmd.getCommandline()); return exe.execute(); } catch (IOException e) { throw new BuildException(e, getLocation()); } }
/** * Executes the given classname with the given arguments in a separate VM. */ private int run(String[] command) throws BuildException { LogStreamHandler logstr = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN); Execute exe = new Execute(logstr); exe.setAntRun(project); exe.setCommandline(command); try { int rc = exe.execute(); if (exe.killedProcess()) { log("Timeout: killed the sub-process", Project.MSG_WARN); } return rc; } catch (IOException e) { throw new BuildException(e, location); } }
private int executeRunnerClassAsForked() throws BuildException { CommandlineJava cmd = initializeJavaCommand(); Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN)); String[] commandLine = cmd.getCommandline(); log("Executing: " + StringUtils.join(Arrays.asList(commandLine), " ")); execute.setCommandline(commandLine); execute.setNewenvironment(false); execute.setAntRun(getProject()); log(cmd.describeCommand(), Project.MSG_VERBOSE); int retVal; try { retVal = execute.execute(); } catch (IOException e) { throw new BuildException("Process fork failed.", e, getLocation()); } return retVal; }
throw new BuildException("Invalid target: %s", targetFile); new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_INFO), null); log(cmdl.describeCommand(), Project.MSG_VERBOSE); process.setCommandline(cmdl.getCommandline()); if (process.execute() != 0) { throw new BuildException("JJDoc failed."); throw new BuildException("Failed to launch JJDoc", e);
if (error == null && output == null) { if (!quiet) { streamhandler = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN); } else { streamhandler = new LogStreamHandler(this, Project.MSG_DEBUG, Project.MSG_DEBUG); } catch (IOException e) { FileUtils.close(fos); throw new BuildException(e, getLocation()); } catch (IOException e) { FileUtils.close(fos); throw new BuildException(e, getLocation()); try { log("Building the RPM based on the " + specFile + " file"); int returncode = exe.execute(); if (Execute.isFailure(returncode)) { String msg = "'" + toExecute.getExecutable() + "' failed with exit code " + returncode; if (failOnError) { throw new BuildException(msg);
throw new BuildException("Required argument repository not specified"); String projectName = pvcsProject.getName(); if (projectName == null || projectName.trim().isEmpty()) { throw new BuildException("name is a required attribute of pvcsproject"); if (Execute.isFailure(result) && !ignorerc) { String msg = "Failed executing: " + commandLine.toString(); throw new BuildException(msg, getLocation()); log("Executing " + commandLine.toString(), Project.MSG_VERBOSE); result = runCmd(commandLine, new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN)); if (result != 0 && !ignorerc) { String msg = "Failed executing: " + commandLine.toString()
/** * Run the command. * @param cmd the command line * @return the exit status of the command */ protected int run(Commandline cmd) { return run(cmd, new LogStreamHandler(this, Project.MSG_VERBOSE, Project.MSG_WARN)); }
/** * Executes the given classname with the given arguments in a separate VM. */ private int run(String[] command) throws BuildException { LogStreamHandler logstr = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN); Execute exe = new Execute(logstr); exe.setAntRun(project); exe.setCommandline(command); try { int rc = exe.execute(); if (exe.killedProcess()) { log("Timeout: killed the sub-process", Project.MSG_WARN); } return rc; } catch (IOException e) { throw new BuildException(e, location); } }
private int executeRunnerClassAsForked() throws BuildException { CommandlineJava cmd = initializeJavaCommand(); Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN)); String[] commandLine = cmd.getCommandline(); log("Executing: " + StringUtils.join(Arrays.asList(commandLine), " ")); execute.setCommandline(commandLine); execute.setNewenvironment(false); execute.setAntRun(getProject()); log(cmd.describeCommand(), Project.MSG_VERBOSE); int retVal; try { retVal = execute.execute(); } catch (IOException e) { throw new BuildException("Process fork failed.", e, getLocation()); } return retVal; }
throw new BuildException("Invalid target: %s", targetFile); } else { if (!outputDirectory.isDirectory()) { throw new BuildException("'outputdirectory' " + outputDirectory + " is not a directory."); new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_INFO), null); log(cmdl.describeCommand(), Project.MSG_VERBOSE); process.setCommandline(cmdl.getCommandline()); if (process.execute() != 0) { throw new BuildException("JJTree failed.");
/** * Executes the given classname with the given arguments in a separate VM. */ private int run(String[] command) throws BuildException { LogStreamHandler logstr = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN); Execute exe = new Execute(logstr); exe.setAntRun(project); exe.setCommandline(command); try { int rc = exe.execute(); if (exe.killedProcess()) { log("Timeout: killed the sub-process", Project.MSG_WARN); } return rc; } catch (IOException e) { throw new BuildException(e, location); } }
/** * Execute the created command line. * * @param cmd The command line to run. * @return int the exit code. * @throws BuildException if something goes wrong */ protected int run(Commandline cmd) { try { Execute exe = new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN)); exe.setAntRun(getProject()); exe.setWorkingDirectory(getProject().getBaseDir()); exe.setCommandline(cmd.getCommandline()); exe.setVMLauncher(false); // Use the OS VM launcher so we get environment variables return exe.execute(); } catch (java.io.IOException e) { throw new BuildException(e, getLocation()); } }
/** * Executes the given classname with the given arguments in a separate VM. */ private int run(String[] command) throws BuildException { LogStreamHandler logstr = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN); Execute exe = new Execute(logstr); exe.setAntRun(project); exe.setCommandline(command); try { int rc = exe.execute(); if (exe.killedProcess()) { log("Timeout: killed the sub-process", Project.MSG_WARN); } return rc; } catch (IOException e) { throw new BuildException(e, location); } }
/** * A utility method that runs an external command. Writes the output and * error streams of the command to the project log. * * @param task The task that the command is part of. Used for logging * @param cmdline The command to execute. * @throws BuildException if the command does not exit successfully. */ public static void runCommand(Task task, String... cmdline) throws BuildException { try { task.log(Commandline.describeCommand(cmdline), Project.MSG_VERBOSE); Execute exe = new Execute( new LogStreamHandler(task, Project.MSG_INFO, Project.MSG_ERR)); exe.setAntRun(task.getProject()); exe.setCommandline(cmdline); int retval = exe.execute(); if (isFailure(retval)) { throw new BuildException(cmdline[0] + " failed with return code " + retval, task.getLocation()); } } catch (IOException exc) { throw new BuildException("Could not launch " + cmdline[0] + ": " + exc, task.getLocation()); } }
private int run(String[] command) throws BuildException { Execute exe; LogStreamHandler logstr = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN); exe = new Execute(logstr); exe.setAntRun(getProject()); exe.setCommandline(command); try { int rc = exe.execute(); if (exe.killedProcess()) { log("Timeout: killed the sub-process", Project.MSG_WARN); } return rc; } catch (IOException e) { throw new BuildException(e, getLocation()); } } }
Execute exe = new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN)); String[] env = exe.getEnvironment(); if (env == null) { env = new String[0]; newEnv[env.length] = "SSDIR=" + serverPath; exe.setEnvironment(newEnv); return exe.execute(); } catch (IOException e) { throw new BuildException(e, getLocation());
private int run(String[] command) throws BuildException { Execute exe; LogStreamHandler logstr = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN); exe = new Execute(logstr); exe.setAntRun(getProject()); exe.setCommandline(command); try { int rc = exe.execute(); if (exe.killedProcess()) { log("Timeout: killed the sub-process", Project.MSG_WARN); } return rc; } catch (IOException e) { throw new BuildException(e, getLocation()); } } }
Execute exe = new Execute(new LogStreamHandler(javah, Project.MSG_INFO, Project.MSG_WARN)); exe.setAntRun(project); exe.setWorkingDirectory(project.getBaseDir()); exe.setCommandline(args); exe.execute(); return !exe.isFailure(); } catch (IOException exception) { throw new BuildException("Error running " + executable + " -maybe it is not on the path", exception);
/** * Executes the given class name with the given arguments in a separate VM. * * @param command arguments. * @return return value from the executed process. */ private int run(String[] command) throws BuildException { Execute exe; LogStreamHandler logstr = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN); exe = new Execute(logstr); exe.setAntRun(getProject()); exe.setCommandline(command); try { int rc = exe.execute(); if (exe.killedProcess()) { log("Timeout: killed the sub-process", Project.MSG_WARN); } return rc; } catch (IOException e) { throw new BuildException(e, getLocation()); } }