org.sonar.api.utils.command
Class CommandExecutor

java.lang.Object
  extended by org.sonar.api.utils.command.CommandExecutor

public class CommandExecutor
extends Object

Synchronously execute a native command line. It's much more limited than the Apache Commons Exec library. For example it does not allow to run asynchronously or to automatically quote command-line arguments.

Since:
2.7

Method Summary
static CommandExecutor create()
           
 int execute(Command command, long timeoutMilliseconds)
          Execute command and display error and output streams in log.
 int execute(Command command, StreamConsumer stdOut, StreamConsumer stdErr, long timeoutMilliseconds)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static CommandExecutor create()

execute

public int execute(Command command,
                   StreamConsumer stdOut,
                   StreamConsumer stdErr,
                   long timeoutMilliseconds)
Throws:
CommandException
Since:
3.0

execute

public int execute(Command command,
                   long timeoutMilliseconds)
Execute command and display error and output streams in log. Method execute(Command, StreamConsumer, StreamConsumer, long) is preferable, when fine-grained control of output of command required.

Throws:
CommandException


Copyright © 2009-2013 SonarSource. All Rights Reserved.