Examples of StreamPumper


Examples of net.sourceforge.cruisecontrol.util.StreamPumper

        p.getOutputStream().close();
        p.getErrorStream().close();
    }

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

Examples of net.sourceforge.cruisecontrol.util.StreamPumper

            new StreamPumper(p.getErrorStream(), new PrintWriter(System.err, true));
        new Thread(errorPumper).start();
    }

    private void logOutStream(Process p) {
        StreamPumper outPumper =
            new StreamPumper(p.getInputStream(), new PrintWriter(System.out, true));
        new Thread(outPumper).start();
    }
View Full Code Here

Examples of net.sourceforge.cruisecontrol.util.StreamPumper

        Process p = null;

        log.debug("Executing: " + commandLine.toString());
        try {
            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

Examples of net.sourceforge.cruisecontrol.util.StreamPumper

        } catch (IOException e) {
            throw new CruiseControlException("Encountered an IO exception while attempting to execute '"
                    + script.toString() + "'. CruiseControl cannot continue.", e);
        }

        StreamPumper errorPumper;
        StreamPumper outPumper;
        if (script instanceof StreamConsumer) {
            errorPumper = new StreamPumper(p.getErrorStream(), (StreamConsumer) script);
            outPumper = new StreamPumper(p.getInputStream(), (StreamConsumer) script);
        } else {
            errorPumper = new StreamPumper(p.getErrorStream());
            outPumper = new StreamPumper(p.getInputStream());
        }
       
       
        new Thread(errorPumper).start();
        new Thread(outPumper).start();
        AsyncKiller killer = new AsyncKiller(p, timeout);
        if (timeout > 0) {
            killer.start();
        }

        try {
            exitCode = p.waitFor();
            killer.interrupt();
            p.getInputStream().close();
            p.getOutputStream().close();
            p.getErrorStream().close();
        } catch (InterruptedException e) {
            LOG.info("Was interrupted while waiting for script 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();
       
        script.setExitCode(exitCode);
       
        return !killer.processKilled();
View Full Code Here

Examples of net.sourceforge.cruisecontrol.util.StreamPumper

    private void executeCommandLine(Commandline commandline) throws CruiseControlException {
        try {
            LOG.info(commandline.toString());
            Process p = Runtime.getRuntime().exec(commandline.getCommandline());

            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) {
View Full Code Here

Examples of net.sourceforge.cruisecontrol.util.StreamPumper

    }

    private void exec(String command)
        throws IOException, InterruptedException {
        Process p = Runtime.getRuntime().exec(command);
        StreamPumper errorPumper = new StreamPumper(p.getErrorStream());
        new Thread(errorPumper).start();
        InputStream input = p.getInputStream();
        p.waitFor();
        p.getOutputStream();
        p.getInputStream();
View Full Code Here

Examples of net.sourceforge.cruisecontrol.util.StreamPumper

        return modifications;
    }

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

Examples of net.sourceforge.cruisecontrol.util.StreamPumper

        p.getOutputStream().close();
        p.getErrorStream().close();
    }

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

Examples of net.sourceforge.cruisecontrol.util.StreamPumper

            new StreamPumper(p.getErrorStream(), new PrintWriter(System.err, true));
        new Thread(errorPumper).start();
    }

    private void logOutStream(Process p) {
        StreamPumper outPumper =
            new StreamPumper(p.getInputStream(), new PrintWriter(System.out, true));
        new Thread(outPumper).start();
    }
View Full Code Here

Examples of net.sourceforge.cruisecontrol.util.StreamPumper

            Process p = Runtime.getRuntime().exec(commandLine, env);
            InputStream errorIn = p.getErrorStream();
            InputStream stdIn = p.getInputStream();
            PrintWriter errorOut = new PrintWriter(System.err, true);
            PrintWriter stdOut = new PrintWriter(System.out, true);
            StreamPumper errorPumper = new StreamPumper(errorIn, errorOut);
            StreamPumper stdPumper = new StreamPumper(stdIn, stdOut);
            new Thread(errorPumper).start();
            new Thread(stdPumper).start();
            p.waitFor();
            p.getInputStream().close();
            p.getOutputStream().close();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.