public abstract class CommandLineUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
CommandLineUtils.StringStreamConsumer |
Constructor and Description |
---|
CommandLineUtils() |
Modifier and Type | Method and Description |
---|---|
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)
|
public static int executeCommandLine(Commandline cl, StreamConsumer systemOut, StreamConsumer systemErr) throws CommandLineException
CommandLineException
public static int executeCommandLine(Commandline cl, InputStream systemIn, StreamConsumer systemOut, StreamConsumer systemErr) throws CommandLineException
CommandLineException
public static Properties getSystemEnvVars() throws IOException
IOException
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)
Copyright © 2002-2012 Apache Software Foundation. All Rights Reserved.