Package org.apache.tools.ant.taskdefs

Examples of org.apache.tools.ant.taskdefs.PumpStreamHandler$ThreadWithPumper


            FileOutputStream fos = new FileOutputStream(tmp);
            tmp2 = new File("pvcs_ant_" + rand.nextLong() + ".log");
            log(commandLine.describeCommand(), Project.MSG_VERBOSE);
            try {
                result = runCmd(commandLine,
                                new PumpStreamHandler(fos,
                                    new LogOutputStream(this,
                                                        Project.MSG_WARN)));
            } finally {
                fos.close();
            }
View Full Code Here


        return new File(outputDirectory, generatedFileName + ".java");
    }

    /** execute in a forked VM */
    private int run(String[] command) throws BuildException {
        PumpStreamHandler psh =
            new PumpStreamHandler(new LogOutputStream(this, Project.MSG_INFO),
                                  new TeeOutputStream(
                                                      new LogOutputStream(this,
                                                                          Project.MSG_WARN),
                                                      bos)
                                  );
View Full Code Here

            "-au", "-I", ".*$" + "Id:.*$.*", // Avoid cvs keyword
            // expansion in this string
            vmFile.getFileName(), cpFile.getFile().getAbsolutePath()};
        final ByteArrayOutputStream out = new ByteArrayOutputStream();
        final ByteArrayOutputStream err = new ByteArrayOutputStream();
        final PumpStreamHandler streamHandler = new PumpStreamHandler(out, err);
        final Execute exe = new Execute(streamHandler);
        exe.setCommandline(cmd);
        exe.setWorkingDirectory(vmFile.getBaseDir());
        final int rc = exe.execute();
        if ((rc != 0) && (out.size() > 0)) {
View Full Code Here

            FileOutputStream fos = new FileOutputStream(tmp);
            tmp2 = new File("pvcs_ant_" + rand.nextLong() + ".log");
            log(commandLine.describeCommand(), Project.MSG_VERBOSE);
            try {
                result = runCmd(commandLine,
                                new PumpStreamHandler(fos,
                                    new LogOutputStream(this,
                                                        Project.MSG_WARN)));
            } finally {
                FileUtils.close(fos);
            }
View Full Code Here

        OutputStream dummyOut = new OutputStream() {
            public void write(int b) throws IOException {
            }
        };

        ExecuteStreamHandler streamHandler = new PumpStreamHandler(dummyOut);
        streamHandler.setProcessErrorStream(process.getErrorStream());
        streamHandler.setProcessOutputStream(process.getInputStream());
        streamHandler.start();

        project.log("spawned process " + process.toString(), Project.MSG_VERBOSE);
        return process;
    }
View Full Code Here

        try {
            Random rand = new Random(System.currentTimeMillis());
            tmp = new File("pvcs_ant_"+rand.nextLong()+".log");
            tmp2 = new File("pvcs_ant_"+rand.nextLong()+".log");
            log("Executing " + commandLine.toString(), Project.MSG_VERBOSE);
            result = runCmd(commandLine, new PumpStreamHandler(new FileOutputStream(tmp), new LogOutputStream(this,Project.MSG_WARN)));
            if ( result != 0 && !ignorerc) {
                String msg = "Failed executing: " + commandLine.toString();
                throw new BuildException(msg, location);
            }
View Full Code Here

        //      try {
        outputstream= new ByteArrayOutputStream();
        errorstream = new ByteArrayOutputStream();
       
        streamhandler =
            new PumpStreamHandler(new PrintStream(outputstream),
                                  new PrintStream(errorstream));
        //      }  catch (IOException e) {
        //          throw new BuildException(e,location);
        //      }
    }
View Full Code Here

            } else if (!quiet) {
                errorstream = new LogOutputStream(this, Project.MSG_WARN);
            } else {
                errorstream = new LogOutputStream(this, Project.MSG_DEBUG);
            }
            streamhandler = new PumpStreamHandler(outputstream, errorstream);
        }

        Execute exe = getExecute(toExecute, streamhandler);
        try {
            log("Building the RPM based on the " + specFile + " file");
View Full Code Here

        if (args != null) {
            cmdLine.addAll(args);
        }
       
        ExecuteWatchdog watchdog = new ExecuteWatchdog( timeout );
        ExecuteStreamHandler streamHandler = new PumpStreamHandler( out, out, in );
        Execute exec = new Execute( streamHandler, watchdog );
        exec.setCommandline( cmdLine.toArray(new String[] {}) );
        List<String> env = getCommandEnvironment(command);
        if (!env.isEmpty()) {
            exec.setEnvironment(env.toArray(new String[] {}) );
View Full Code Here

        if (args != null) {
            cmdLine.addAll(args);
        }
       
        ExecuteWatchdog watchdog = new ExecuteWatchdog( timeout );
        ExecuteStreamHandler streamHandler = new PumpStreamHandler( out, out, in );
        Execute exec = new Execute( streamHandler, watchdog );
        exec.setCommandline( cmdLine.toArray(new String[] {}) );
        List<String> env = getCommandEnvironment(command);
        if (!env.isEmpty()) {
            exec.setEnvironment(env.toArray(new String[] {}) );
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.taskdefs.PumpStreamHandler$ThreadWithPumper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.