|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.plexus.util.cli.CommandLineUtils
Nested Class Summary | |
static class |
CommandLineUtils.StringStreamConsumer
|
Constructor Summary | |
CommandLineUtils()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CommandLineUtils()
Method Detail |
public static int executeCommandLine(Commandline cl, StreamConsumer systemOut, StreamConsumer systemErr) throws CommandLineException
CommandLineException
public static int executeCommandLine(Commandline cl, StreamConsumer systemOut, StreamConsumer systemErr, int timeoutInSeconds) throws CommandLineException
CommandLineException
public static int executeCommandLine(Commandline cl, InputStream systemIn, StreamConsumer systemOut, StreamConsumer systemErr) throws CommandLineException
CommandLineException
public static int executeCommandLine(Commandline cl, InputStream systemIn, StreamConsumer systemOut, StreamConsumer systemErr, int timeoutInSeconds) throws CommandLineException
cl
- systemIn
- systemOut
- systemErr
- timeoutInSeconds
-
CommandLineException
- or CommandLineTimeOutException if time out occurspublic static Properties getSystemEnvVars() throws IOException
getSystemEnvVars().get("path")
and getSystemEnvVars().get("PATH")
will in general return different values. However, on platforms
with case-insensitive environment variables like Windows, all variable names will be normalized to upper case.
null
.
IOException
- If the environment variables could not be queried from the shell.public static Properties getSystemEnvVars(boolean caseSensitive) throws IOException
caseSensitive == true
, then envar
keys will all be upper-case.
caseSensitive
- Whether environment variable keys should be treated case-sensitively.
IOException
public static void killProcess(long pid)
pid
- The pid of command return by Commandline.getPid()public static boolean isAlive(long pid)
public static boolean isAlive(Process p)
public static String[] translateCommandline(String toProcess) throws Exception
Exception
public static String quote(String argument) throws CommandLineException
StringUtils.quoteAndEscape(String, char, char[], char[], char, boolean)
,
StringUtils.quoteAndEscape(String, char, char[], char, boolean)
, or
StringUtils.quoteAndEscape(String, char)
instead.
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.
CommandLineException
- if the argument contains both, single
and double quotes.public static String quote(String argument, boolean wrapExistingQuotes) throws CommandLineException
StringUtils.quoteAndEscape(String, char, char[], char[], char, boolean)
,
StringUtils.quoteAndEscape(String, char, char[], char, boolean)
, or
StringUtils.quoteAndEscape(String, char)
instead.
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.
CommandLineException
- if the argument contains both, single
and double quotes.public static String quote(String argument, boolean escapeSingleQuotes, boolean escapeDoubleQuotes, boolean wrapExistingQuotes) throws CommandLineException
StringUtils.quoteAndEscape(String, char, char[], char[], char, boolean)
,
StringUtils.quoteAndEscape(String, char, char[], char, boolean)
, or
StringUtils.quoteAndEscape(String, char)
instead.
CommandLineException
public static String toString(String[] line)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |