/** * Executes the given source-file or classname with the given arguments in a separate VM. * @param command String[] of command-line arguments. */ private int fork(String[] command) throws BuildException { Execute exe = new Execute(redirector.createHandler(), createWatchdog()); setupExecutable(exe, command); try { int rc = exe.execute(); redirector.complete(); if (exe.killedProcess()) { throw new BuildException(TIMEOUT_MESSAGE); } return rc; } catch (IOException e) { throw new BuildException(e, getLocation()); } }
redirector.complete(); if (Execute.isFailure(returnCode)) { if (failOnError) {
/** * Executes the given classname with the given arguments as it * were a command line application. * @param command CommandlineJava. */ private void run(CommandlineJava command) throws BuildException { try { ExecuteJava exe = new ExecuteJava(); exe.setJavaCommand(command.getJavaCommand()); exe.setClasspath(command.getClasspath()); exe.setSystemProperties(command.getSystemProperties()); exe.setPermissions(perm); exe.setTimeout(timeout); redirector.createStreams(); exe.execute(getProject()); redirector.complete(); if (exe.killedProcess()) { throw new BuildException(TIMEOUT_MESSAGE); } } catch (IOException e) { throw new BuildException(e); } }
redirector.complete(); return rc; } catch (IOException e) {
/** * Ask redirector to close all the streams. It is necessary to call this method * before leaving the Task to have the Streams flush their contents. If you are * collecting output in a property, it will be created only if this method is * called, otherwise you'll find it unset. */ protected void closeRedirector() { try { if (redirectOutput && redirectOutPrintStream != null) { redirector.complete(); } } catch (IOException ioe) { log("Error closing redirector: " + ioe.getMessage(), Project.MSG_ERR); } /* * Due to depends chain, Ant could call the Task more than once, * this is to prevent that we attempt to reuse the previously * closed Streams. */ redirectOutStream = null; redirectOutPrintStream = null; redirectErrStream = null; redirectErrPrintStream = null; }
private int sshexecRedirectStreams(Statement statement) throws IOException { exec.setStreamHandler(redirector.createHandler()); log("starting java as:\n" + statement.render(osFamily), Project.MSG_VERBOSE); int exitStatus; try { exitStatus = sshexec(statement.render(osFamily)); } finally { redirector.complete(); } return exitStatus; }
redirector.complete(); return rc; } catch (IOException e) {