org.codehaus.plexus.util.cli
public abstract class CommandLineUtils extends Object
Version: $Id: CommandLineUtils.java 6570 2007-06-30 11:31:19Z olamy $
Nested Class Summary | |
---|---|
static class | CommandLineUtils.StringStreamConsumer |
Field Summary | |
---|---|
static Map | processes |
Method Summary | |
---|---|
static int | executeCommandLine(Commandline cl, StreamConsumer systemOut, StreamConsumer systemErr) |
static int | executeCommandLine(Commandline cl, InputStream systemIn, 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 (quote(String argument) Put quotes around the given String if necessary. If the argument doesn't include spaces or quotes, return it as is. |
static String | quote(String argument, boolean wrapExistingQuotes) Put quotes around the given String if necessary. If the argument doesn't include spaces or quotes, return it as is. |
static String | quote(String argument, boolean escapeSingleQuotes, boolean escapeDoubleQuotes, boolean wrapExistingQuotes) |
static String | toString(String[] line) |
static String[] | translateCommandline(String toProcess) |
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
Parameters: pid The pid of command return by Commandline.getPid()
Put quotes around the given String if necessary.
If the argument doesn't include spaces or quotes, return it as is. If it contains double quotes, use single quotes - else surround the argument by double quotes.
Throws: CommandLineException if the argument contains both, single and double quotes.
Put quotes around the given String if necessary.
If the argument doesn't include spaces or quotes, return it as is. If it contains double quotes, use single quotes - else surround the argument by double quotes.
Throws: CommandLineException if the argument contains both, single and double quotes.