randoop.util
Class Command

Object
  extended by Command

public class Command
extends Object

The important method in this class is exec(String[]). It executes its argument and pipes both stdout and stderr to System.out. Each line in the piped output from stdout is prefixed with "OUT>" and the output from stderr is prefixed with "ERR>"

Credit: Producer code modified (and augmented) from Michael Daconta's "Java Traps" column ("When Runtime.exec() won't"), found at http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html


Nested Class Summary
Modifier and Type Class and Description
static class Command.StreamGobbler
          Helper class for Command.
 
Constructor Summary
Constructor and Description
Command()
           
 
Method Summary
Modifier and Type Method and Description
static int exec(String cmd)
          Runs cmd, redirecting stdout and stderr to System.out.
static int exec(String[] cmd)
          Runs cmd, redirecting stdout and stderr to System.out.
static int exec(String[] cmd, PrintStream out)
          Runs cmd, redirecting stdout and stderr to `out' and prefixing the output from stout with "OUT>" and the output from stderr with "ERR>".
static int exec(String[] cmd, PrintStream out, String prompt)
           
static int exec(String[] cmd, PrintStream out, String prompt, boolean gobbleChars)
           
static void runCommand(String[] command, String prompt, boolean verbose, String nonVerboseMessage, boolean gobbleChars)
           
static void runCommand(String[] command, String prompt, boolean verbose, String nonVerboseMessage, boolean okToFail, boolean gobbleChars)
           
static void runCommandOKToFail(String[] command, String prompt, boolean verbose, String nonVerboseMessage, boolean gobbleChars)
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Command

public Command()
Method Detail

runCommand

public static void runCommand(String[] command,
                              String prompt,
                              boolean verbose,
                              String nonVerboseMessage,
                              boolean gobbleChars)

runCommandOKToFail

public static void runCommandOKToFail(String[] command,
                                      String prompt,
                                      boolean verbose,
                                      String nonVerboseMessage,
                                      boolean gobbleChars)

runCommand

public static void runCommand(String[] command,
                              String prompt,
                              boolean verbose,
                              String nonVerboseMessage,
                              boolean okToFail,
                              boolean gobbleChars)

exec

public static int exec(String cmd)
Runs cmd, redirecting stdout and stderr to System.out.


exec

public static int exec(String[] cmd)
Runs cmd, redirecting stdout and stderr to System.out.


exec

public static int exec(String[] cmd,
                       PrintStream out)
Runs cmd, redirecting stdout and stderr to `out' and prefixing the output from stout with "OUT>" and the output from stderr with "ERR>". Returns whatever exit number is returned by the subprocess invoking the command.


exec

public static int exec(String[] cmd,
                       PrintStream out,
                       String prompt)

exec

public static int exec(String[] cmd,
                       PrintStream out,
                       String prompt,
                       boolean gobbleChars)