Class CommandLineUtils
java.lang.Object
org.apache.maven.shared.utils.cli.CommandLineUtils
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
AStreamConsumer
providing consumed lines as aString
. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
Number of milliseconds per second.private static final long
Number of nanoseconds per second. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static Properties
ensureCaseSensitivity
(Map<String, String> envs, boolean preserveKeyCase) static int
executeCommandLine
(Commandline cl, InputStream systemIn, StreamConsumer systemOut, StreamConsumer systemErr) static int
executeCommandLine
(Commandline cl, InputStream systemIn, StreamConsumer systemOut, StreamConsumer systemErr, int timeoutInSeconds) static int
executeCommandLine
(Commandline cl, InputStream systemIn, StreamConsumer systemOut, StreamConsumer systemErr, int timeoutInSeconds, Runnable runAfterProcessTermination) static int
executeCommandLine
(Commandline cl, InputStream systemIn, StreamConsumer systemOut, StreamConsumer systemErr, int timeoutInSeconds, Runnable runAfterProcessTermination, Charset streamCharset) static int
executeCommandLine
(Commandline cl, StreamConsumer systemOut, StreamConsumer systemErr) static int
executeCommandLine
(Commandline cl, StreamConsumer systemOut, StreamConsumer systemErr, int timeoutInSeconds) static CommandLineCallable
executeCommandLineAsCallable
(Commandline cl, InputStream systemIn, StreamConsumer systemOut, StreamConsumer systemErr, int timeoutInSeconds, Runnable runAfterProcessTermination) Immediately forks a process, returns a callable that will block until process is complete.static CommandLineCallable
executeCommandLineAsCallable
(Commandline cl, InputStream systemIn, StreamConsumer systemOut, StreamConsumer systemErr, int timeoutInSeconds, Runnable runAfterProcessTermination, Charset streamCharset) Immediately forks a process, returns a callable that will block until process is complete.static Properties
Deprecated.use System#getenv()static Properties
getSystemEnvVars
(boolean caseSensitive) Deprecated.use System#getenv()private static boolean
static String
static String[]
translateCommandline
(String toProcess)
-
Field Details
-
MILLIS_PER_SECOND
private static final long MILLIS_PER_SECONDNumber of milliseconds per second.- See Also:
-
NANOS_PER_SECOND
private static final long NANOS_PER_SECONDNumber of nanoseconds per second.- See Also:
-
-
Constructor Details
-
CommandLineUtils
public CommandLineUtils()
-
-
Method Details
-
getSystemEnvVars
Deprecated.use System#getenv()Gets the shell environment variables for this process. Note that the returned mapping from variable names to values will always be case-sensitive regardless of the platform, i.e.getSystemEnvVars().get("path")
andgetSystemEnvVars().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.- Returns:
- The shell environment variables, can be empty but never
null
.
-
getSystemEnvVars
Deprecated.use System#getenv()Return the shell environment variables. IfcaseSensitive == 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.
-
isAlive
-
translateCommandline
- Parameters:
toProcess
- The command line to translate.- Returns:
- The array of translated parts.
- Throws:
CommandLineException
- in case of unbalanced quotes.
-
toString
- Parameters:
line
- the lines- Returns:
- the concatenated lines, quoted and escaped, separated by spaces
-
ensureCaseSensitivity