org.apache.maven.it.util.cli
Class CommandLineUtils

java.lang.Object
  extended by org.apache.maven.it.util.cli.CommandLineUtils

public abstract class CommandLineUtils
extends Object

Version:
$Id: CommandLineUtils.java 748485 2009-02-27 11:02:03Z bentmann $
Author:
Trygve Laugstøl

Nested Class Summary
static class CommandLineUtils.StringStreamConsumer
           
 
Constructor Summary
CommandLineUtils()
           
 
Method Summary
static int executeCommandLine(Commandline cl, InputStream systemIn, StreamConsumer systemOut, StreamConsumer systemErr)
           
static int executeCommandLine(Commandline cl, StreamConsumer systemOut, StreamConsumer systemErr)
           
static Properties getSystemEnvVars()
           
static Properties getSystemEnvVars(boolean caseSensitive)
          Return the shell environment variables.
static boolean isAlive(long pid)
           
static void killProcess(long pid)
          Kill a process launched by executeCommandLine methods Doesn't work correctly on windows, only the cmd process will be destroy but not the sub process (Bug ID 4770092)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandLineUtils

public CommandLineUtils()
Method Detail

executeCommandLine

public static int executeCommandLine(Commandline cl,
                                     StreamConsumer systemOut,
                                     StreamConsumer systemErr)
                              throws CommandLineException
Throws:
CommandLineException

executeCommandLine

public static int executeCommandLine(Commandline cl,
                                     InputStream systemIn,
                                     StreamConsumer systemOut,
                                     StreamConsumer systemErr)
                              throws CommandLineException
Throws:
CommandLineException

getSystemEnvVars

public static Properties getSystemEnvVars()
                                   throws IOException
Throws:
IOException

getSystemEnvVars

public static Properties getSystemEnvVars(boolean caseSensitive)
                                   throws IOException
Return the shell environment variables. If caseSensitive == true, then envar keys will all be upper-case.

Parameters:
caseSensitive - Whether environment variable keys should be treated case-sensitively.
Returns:
Properties object of (possibly modified) envar keys mapped to their values.
Throws:
IOException

killProcess

public static void killProcess(long pid)
Kill a process launched by executeCommandLine methods Doesn't work correctly on windows, only the cmd process will be destroy but not the sub process (Bug ID 4770092)

Parameters:
pid - The pid of command return by Commandline.getPid()

isAlive

public static boolean isAlive(long pid)


Copyright © 2002-2011 The Apache Software Foundation. All Rights Reserved.