Examples of PumpStreamHandler


Examples of org.apache.commons.exec.PumpStreamHandler

//      ExecuteWatchdog watchdog = new ExecuteWatchdog(30*1000);
      final Executor executor = new DefaultExecutor();
      executor.setExitValue(1);
//      executor.setWatchdog(watchdog);
//      executor.setProcessDestroyer(MPlayerFileService.PROCESS_SHUTDOWN_HOOK);
      executor.setStreamHandler(new PumpStreamHandler(this.out, this.err));
      executor.setWorkingDirectory(this.tempFolder);
      executor.execute(cmdLine, this);
     
//    } else {
//      throw new ExecuteException("mts will not work with mplayer -identify", 0);
View Full Code Here

Examples of org.apache.commons.exec.PumpStreamHandler

//      ExecuteWatchdog watchdog = new ExecuteWatchdog(5*1000);
      final Executor executor = new DefaultExecutor();
      executor.setExitValue(1);
//      executor.setWatchdog(watchdog);
//      executor.setProcessDestroyer(MPlayerFileService.PROCESS_SHUTDOWN_HOOK);
      executor.setStreamHandler(new PumpStreamHandler(this.out, this.err));
      executor.execute(cmdLine, this);

//    } else {
//      throw new ExecuteException("mts will not work with mplayer -identify", 0);
//    }
View Full Code Here

Examples of org.apache.commons.exec.PumpStreamHandler

     * @throws IOException starting the process failed
     */
    protected BufferedReader runProcEnvCommand() throws IOException {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        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

        ByteArrayOutputStream err = new ByteArrayOutputStream();

        DefaultExecutor executor = prepareDefaultExecutor(command);
        // handle error and output of the process and write them to the given
        // out stream
        PumpStreamHandler handler = new PumpStreamHandler(out, err, command.getInput());
        executor.setStreamHandler(handler);

        CommandLine cl = toCommandLine(command);

        try {
View Full Code Here

Examples of org.apache.commons.exec.PumpStreamHandler

        Executor executor = new DefaultExecutor();
        ByteArrayOutputStream os = new ByteArrayOutputStream();

        try {
            executor.setStreamHandler(new PumpStreamHandler(os, os));
            executor.execute(CommandLine.parse(from.getPath() + " -V"));
        } catch (IOException e) {
            throw new PlatformDependentTools.ThisIsNotNginxExecutableException(e);
        }
View Full Code Here

Examples of org.apache.commons.exec.PumpStreamHandler

        // Setup stdout and stderr
        int nbytes = appConf.getInt(AppConfig.EXEC_MAX_BYTES_NAME, -1);
        ByteArrayOutputStream outStream = new MaxByteArrayOutputStream(nbytes);
        ByteArrayOutputStream errStream = new MaxByteArrayOutputStream(nbytes);
        executor.setStreamHandler(new PumpStreamHandler(outStream, errStream));

        // Only run for N milliseconds
        int timeout = appConf.getInt(AppConfig.EXEC_TIMEOUT_NAME, 0);
        ExecuteWatchdog watchdog = new ExecuteWatchdog(timeout);
        executor.setWatchdog(watchdog);
View Full Code Here

Examples of org.apache.commons.exec.PumpStreamHandler

    return example;
  }

  private static String execute(String commandLine) throws ExecuteException, IOException {
    ByteArrayOutputStream stdout = new ByteArrayOutputStream();
    PumpStreamHandler psh = new PumpStreamHandler(stdout);
    CommandLine cl = CommandLine.parse("/bin/bash " + commandLine);
    DefaultExecutor exec = new DefaultExecutor();
    exec.setWorkingDirectory(PROJECT_BASE_DIR);
    exec.setStreamHandler(psh);
    try {
View Full Code Here

Examples of org.apache.commons.exec.PumpStreamHandler

                log.error(String.format("Command logged an error: %s", line));
                out.println(line);
            }
        };
       
        PumpStreamHandler streamHandler = new PumpStreamHandler(outputStream, errorStream);
        executor.setStreamHandler(streamHandler);
        executor.setProcessDestroyer(processDestroyer);
       
//        (new Thread(new Runnable(){
//            public void run(){
View Full Code Here

Examples of org.apache.commons.exec.PumpStreamHandler

     * @throws IOException starting the process failed
     */
    protected BufferedReader runProcEnvCommand() throws IOException {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        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

        ByteArrayOutputStream err = new ByteArrayOutputStream();

        DefaultExecutor executor = prepareDefaultExecutor(command);
        // handle error and output of the process and write them to the given
        // out stream
        PumpStreamHandler handler = new PumpStreamHandler(out, err, command.getInput());
        executor.setStreamHandler(handler);

        CommandLine cl = toCommandLine(command);

        try {
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.