Examples of PumpStreamHandler


Examples of org.apache.commons.exec.PumpStreamHandler

     * @throws IOException starting the process failed
     */
    protected BufferedReader runProcEnvCommand() throws IOException {
        final ByteArrayOutputStream out = new ByteArrayOutputStream();
        final Executor exe = new DefaultExecutor();
        exe.setStreamHandler(new PumpStreamHandler(out));
        // ignore the exit value - Just try to use what we got
        exe.execute(getProcEnvCommand());
        return new BufferedReader(new StringReader(toString(out)));
    }
View Full Code Here

Examples of org.apache.commons.exec.PumpStreamHandler

        Executor exec = new DefaultExecutor();
        Map<String, String> env = new HashMap<String, String>(System.getenv());
//        env.put("path", ";");
//        env.put("path", System.getProperty("java.home"));

        ExecuteStreamHandler handler = new PumpStreamHandler(System.out, System.err, System.in);
        exec.setStreamHandler(handler);
        exec.setWorkingDirectory(getWorkingDirectory());

        int status;
        try {
View Full Code Here

Examples of org.apache.commons.exec.PumpStreamHandler

        cl.addArgument("-jar");
        cl.addArgument(jarToExecute.getAbsolutePath());
        cl.addArgument("-p");
        cl.addArgument(String.valueOf(serverPort));
        log.info("Executing " + cl);
        e.setStreamHandler(new PumpStreamHandler());
        e.setProcessDestroyer(new ShutdownHookProcessDestroyer());
        e.execute(cl, h);
    }
View Full Code Here

Examples of org.apache.felix.karaf.shell.commands.utils.PumpStreamHandler

    private List<String> args;

    protected Object doExecute() throws Exception {
        ProcessBuilder builder = new ProcessBuilder(args);

        PumpStreamHandler handler = new PumpStreamHandler(System.in, System.out, System.err);

        log.info("Executing: {}", builder.command());
        Process p = builder.start();

        handler.attach(p);
        handler.start();

        log.debug("Waiting for process to exit...");

        int status = p.waitFor();


        log.info("Process exited w/status: {}", status);

        handler.stop();

        return null;
    }
View Full Code Here

Examples of org.apache.geronimo.gshell.common.io.PumpStreamHandler

  private int chmod(File serviceFile, String mode) throws Exception {
    ProcessBuilder builder = new ProcessBuilder();
    builder.command("chmod", mode, serviceFile.getCanonicalPath());
        Process p = builder.start();

        PumpStreamHandler handler = new PumpStreamHandler(io.inputStream, io.outputStream, io.errorStream);
        handler.attach(p);
        handler.start();
        int status = p.waitFor();
        handler.stop();
        return status;
  }
View Full Code Here

Examples of org.apache.geronimo.gshell.io.PumpStreamHandler

  private int chmod(File serviceFile, String mode) throws Exception {
    ProcessBuilder builder = new ProcessBuilder();
    builder.command("chmod", mode, serviceFile.getCanonicalPath());
        Process p = builder.start();

        PumpStreamHandler handler = new PumpStreamHandler(io.inputStream, io.outputStream, io.errorStream);
        handler.attach(p);
        handler.start();
        int status = p.waitFor();
        handler.stop();
        return status;
  }
View Full Code Here

Examples of org.apache.karaf.shell.commands.utils.PumpStreamHandler

    private List<String> args;

    protected Object doExecute() throws Exception {
        ProcessBuilder builder = new ProcessBuilder(args);

        PumpStreamHandler handler = new PumpStreamHandler(System.in, System.out, System.err);

        log.info("Executing: {}", builder.command());
        Process p = builder.start();

        handler.attach(p);
        handler.start();

        log.debug("Waiting for process to exit...");

        int status = p.waitFor();


        log.info("Process exited w/status: {}", status);

        handler.stop();

        return null;
    }
View Full Code Here

Examples of org.apache.karaf.util.process.PumpStreamHandler

    private List<String> args;

    protected Object doExecute() throws Exception {
        ProcessBuilder builder = new ProcessBuilder(args);

        PumpStreamHandler handler = new PumpStreamHandler(System.in, System.out, System.err, "Command" + args.toString());

        log.info("Executing: {}", builder.command());
        Process p = builder.start();

        handler.attach(p);
        handler.start();

        log.debug("Waiting for process to exit...");

        int status = p.waitFor();


        log.info("Process exited w/status: {}", status);

        handler.stop();

        return null;
    }
View Full Code Here

Examples of org.apache.karaf.util.process.PumpStreamHandler

    private List<String> args;

    protected Object doExecute() throws Exception {
        ProcessBuilder builder = new ProcessBuilder(args);

        PumpStreamHandler handler = new PumpStreamHandler(System.in, System.out, System.err, "Command" + args.toString());

        log.info("Executing: {}", builder.command());
        Process p = builder.start();

        handler.attach(p);
        handler.start();

        log.debug("Waiting for process to exit...");
       
        int status = p.waitFor();

        log.info("Process exited w/status: {}", status);

        handler.stop();

        return null;
    }
View Full Code Here

Examples of org.apache.karaf.util.process.PumpStreamHandler

    private List<String> args;

    protected Object doExecute() throws Exception {
        ProcessBuilder builder = new ProcessBuilder(args);

        PumpStreamHandler handler = new PumpStreamHandler(System.in, System.out, System.err, "Command" + args.toString());

        log.info("Executing: {}", builder.command());
        Process p = builder.start();

        handler.attach(p);
        handler.start();

        log.debug("Waiting for process to exit...");
       
        int status = p.waitFor();

        log.info("Process exited w/status: {}", status);

        handler.stop();

        return null;
    }
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.