| Modifier and Type | Method and Description |
|---|---|
static ProcessBuilder |
getBuilder(String... commands)
Create a
ProcessBuilder that, on the appropriate platforms,
sources the standard interactive profile for the user (i.e. |
static ProcessBuilder |
getBuilderWithPipeSupport(String... commands)
Create a
ProcessBuilder that, on the appropriate platforms,
sources the standard interactive profile for the user (i.e. |
static String |
getCurrentPid()
Return the pid of the current process.
|
static List<String> |
getStdErr(Process process)
Get the stderr for
process. |
static List<String> |
getStdOut(Process process)
Get the stdout for
process. |
static boolean |
isPidRunning(String pid)
Check if the process with the processId is running.
|
static void |
waitForSuccessfulCompletion(Process process)
Similar to
Process.waitFor() but will throw a
RuntimeException if the process does not have an exit code of
0. |
public static ProcessBuilder getBuilder(String... commands)
ProcessBuilder that, on the appropriate platforms,
sources the standard interactive profile for the user (i.e.
~/.bash_profile).commands - a string array containing the program and its argumentsProcessBuilderpublic static ProcessBuilder getBuilderWithPipeSupport(String... commands)
ProcessBuilder that, on the appropriate platforms,
sources the standard interactive profile for the user (i.e.
~/.bash_profile) and supports the use of the pipe (|) redirection on
platforms that allow it.commands - a string array containing the program and its argumentsProcessBuilderpublic static List<String> getStdErr(Process process)
process.process - public static List<String> getStdOut(Process process)
process.process - public static boolean isPidRunning(String pid)
pid - Id for the input process.public static void waitForSuccessfulCompletion(Process process)
Process.waitFor() but will throw a
RuntimeException if the process does not have an exit code of
0.process - public static String getCurrentPid()