Package net.sourceforge.cruisecontrol.util

Examples of net.sourceforge.cruisecontrol.util.StreamPumper


            modification.comment = "";
        }
    }

    private static void logStream(InputStream inStream, OutputStream outStream) {
        StreamPumper errorPumper = new StreamPumper(inStream, new PrintWriter(
                outStream, true));
        new Thread(errorPumper).start();
    }
View Full Code Here


        try {
            Process p = Runtime.getRuntime().exec(commandArray);

            //Logging the error stream.
            StreamPumper errorPumper =
                new StreamPumper(p.getErrorStream(),
                                 new PrintWriter(System.err, true));
            new Thread(errorPumper).start();

            //The input stream has the log information that we want to parse.
            InputStream input = p.getInputStream();
            mods = parseStream(input);

            //Using another stream pumper here will get rid of any leftover data in the stream.
            StreamPumper outPumper = new StreamPumper(input,
                                                      (PrintWriter) null);
            new Thread(outPumper).start();

            p.waitFor();
            p.getInputStream().close();
View Full Code Here

        return mods;
    }

    private void getRidOfLeftoverData(InputStream stream) {
        StreamPumper outPumper = new StreamPumper(stream, (PrintWriter) null);
        new Thread(outPumper).start();
    }
View Full Code Here

    protected void setMailAliases(Hashtable mailAliases) {
        this.mailAliases = mailAliases;
    }

    private void logErrorStream(Process p) {
        StreamPumper errorPumper =
            new StreamPumper(p.getErrorStream(), new PrintWriter(System.err, true));
        new Thread(errorPumper).start();
    }
View Full Code Here

                    "Encountered an IO exception while attempting to execute Maven."
                        + " CruiseControl cannot continue.",
                    e);
            }

            StreamPumper errorPumper = new StreamPumper(p.getErrorStream(), this);
            StreamPumper outPumper = new StreamPumper(p.getInputStream(), this);
            Thread errorPumperThread = new Thread(errorPumper);
            Thread outPumperThread = new Thread(outPumper);
            errorPumperThread.start();
            outPumperThread.start();
            int exitCode = 1;

            try {
                exitCode = p.waitFor();
                errorPumperThread.join();
                outPumperThread.join();
                p.getInputStream().close();
                p.getOutputStream().close();
                p.getErrorStream().close();
            } catch (InterruptedException e) {
                LOG.info(
                    "Was interrupted while waiting for Maven to finish."
                        + " CruiseControl will continue, assuming that it completed");
            } catch (IOException ie) {
                LOG.info("Exception trying to close Process streams.", ie);
            }

            outPumper.flush();
            errorPumper.flush();
            flushCurrentElement();

            // The maven.bat actually never returns error,
            // due to internal cleanup called after the execution itself...
View Full Code Here

                "Encountered an IO exception while attempting to execute Ant."
                    + " CruiseControl cannot continue.",
                e);
        }

        StreamPumper errorPumper = new StreamPumper(p.getErrorStream());
        StreamPumper outPumper = new StreamPumper(p.getInputStream());
        new Thread(errorPumper).start();
        new Thread(outPumper).start();

        try {
            p.waitFor();
            p.getInputStream().close();
            p.getOutputStream().close();
            p.getErrorStream().close();
        } catch (InterruptedException e) {
            LOG.info(
                "Was interrupted while waiting for Ant to finish."
                    + " CruiseControl will continue, assuming that it completed");
        } catch (IOException ie) {
            LOG.info("Exception trying to close Process streams.", ie);
        }

        outPumper.flush();
        errorPumper.flush();

        //read in log file as element, return it
        File logFile = new File(antWorkingDir, tempFileName);
        if (!logFile.exists()) {
View Full Code Here

   
    // TODO: Refactor this into a class. Then we can mock it and unit test bootstrap()
    private void executeCommandLine(String commandline) throws CruiseControlException {
        try {
            Process p = Runtime.getRuntime().exec(commandline);
            new Thread(new StreamPumper(p.getInputStream())).start();
            new Thread(new StreamPumper(p.getErrorStream())).start();
            p.waitFor();
        } catch (IOException e) {
            throw new CruiseControlException("Problem trying to execute command line process", e);
        } catch (InterruptedException e) {
            throw new CruiseControlException("Problem trying to execute command line process", e);
View Full Code Here

            String[] env = VSSHelper.loadVSSEnvironment(serverPath);

            Process p = Runtime.getRuntime().exec(commandLine, env);
            InputStream errorIn = p.getErrorStream();
            PrintWriter errorOut = new PrintWriter(System.err, true);
            StreamPumper errorPumper = new StreamPumper(errorIn, errorOut);
            new Thread(errorPumper).start();
            p.waitFor();
            p.getInputStream().close();
            p.getOutputStream().close();
            p.getErrorStream().close();
View Full Code Here

        if (LOG.isDebugEnabled()) {
            LOG.debug("Executing: " + commandLine.toString());
        }
        try {
            Process p = Runtime.getRuntime().exec(commandLine.getCommandline());
            StreamPumper errorPumper =
                new StreamPumper(p.getErrorStream(), new PrintWriter(System.err, true));
            new Thread(errorPumper).start();
            p.waitFor();
            p.getInputStream().close();
            p.getOutputStream().close();
            p.getErrorStream().close();
View Full Code Here

    public void bootstrap() {
        try {
            Commandline commandLine = buildUpdateCommand();
            Process p = commandLine.execute();
            final boolean autoFlushOn = true;
            StreamPumper errorPumper =
                new StreamPumper(p.getErrorStream(), new PrintWriter(System.err, autoFlushOn));
            StreamPumper outPumper = new StreamPumper(p.getInputStream(), new PrintWriter(System.out, autoFlushOn));
            Thread errorPumperThread = new Thread(errorPumper);
            Thread outPumperThread = new Thread(outPumper);
            errorPumperThread.start();
            outPumperThread.start();
            p.waitFor();
View Full Code Here

TOP

Related Classes of net.sourceforge.cruisecontrol.util.StreamPumper

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.