public class Exec
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<java.lang.String> |
cmd |
| Constructor and Description |
|---|
Exec(java.lang.Iterable<java.lang.String> command) |
Exec(java.lang.String... command) |
| Modifier and Type | Method and Description |
|---|---|
static Execed |
appAs(java.lang.String as,
java.lang.Iterable<java.lang.String> command)
Runs a command, optionally executing as a different user (eg root)
|
static Execed |
appAs(java.lang.String as,
java.lang.String... command)
Runs a command, optionally executing as a different user (eg root)
|
java.lang.String |
getEnv(java.lang.String key) |
java.lang.ProcessBuilder |
getProcessBuilder()
Returns a ProcessBuilder for use in a manual launching
|
boolean |
getRedirectError() |
java.io.File |
getWorkingDirectory() |
protected static java.lang.String |
join(java.lang.String with,
java.util.List<java.lang.String> strings) |
protected static java.lang.String |
join(java.lang.String with,
java.lang.String... strings) |
static Execed |
rootUtility(java.lang.Iterable<java.lang.String> command)
Runs a command in "utility" mode: redirecting stderr to stdout and running as root
|
static Execed |
rootUtility(java.lang.String... command)
Runs a command in "utility" mode: redirecting stderr to stdout and running as root
|
Exec |
runAs(java.lang.String username) |
Exec |
runAsSuperuser() |
Exec |
setEnv(java.lang.String key,
java.lang.String value) |
Exec |
setRedirectError(boolean value) |
Exec |
setWorkingDirectory(java.io.File dir) |
Execed |
start()
Launches the process, returning a handle to it for IO ops, etc.
The finish condition for the OutputProcess is that all processes outputting to standard out must be complete before proceeding |
BaseExeced |
startBasic()
Launches the process, returning a handle to it for IO ops, etc
the caller must read the output streams: otherwise the buffers may fill up and the remote program will be suspended indefinitely |
java.lang.ProcessBuilder |
startManually()
Deprecated.
|
static Execed |
utility(java.lang.Iterable<java.lang.String> command)
Runs a command in "utility" mode: redirecting stderr to stdout and optionally executing as a different user (eg root)
|
static Execed |
utility(java.lang.String... command)
Runs a command in "utility" mode: redirecting stderr to stdout and optionally executing as a different user (eg root)
|
static Execed |
utilityAs(java.lang.String as,
java.lang.Iterable<java.lang.String> command)
Runs a command in "utility" mode: redirecting stderr to stdout and optionally executing as a different user (eg root)
|
static Execed |
utilityAs(java.lang.String as,
java.lang.String... command)
Runs a command in "utility" mode: redirecting stderr to stdout and optionally executing as a different user (eg root)
|
public Exec(java.lang.String... command)
public Exec(java.lang.Iterable<java.lang.String> command)
public java.io.File getWorkingDirectory()
public Exec setWorkingDirectory(java.io.File dir)
public Exec setEnv(java.lang.String key, java.lang.String value)
public java.lang.String getEnv(java.lang.String key)
public Exec runAsSuperuser()
public Exec runAs(java.lang.String username)
public boolean getRedirectError()
public Exec setRedirectError(boolean value)
public BaseExeced startBasic() throws java.io.IOException
java.io.IOExceptionpublic Execed start() throws java.io.IOException
java.io.IOException@Deprecated public java.lang.ProcessBuilder startManually()
public java.lang.ProcessBuilder getProcessBuilder()
protected static java.lang.String join(java.lang.String with,
java.lang.String... strings)
protected static java.lang.String join(java.lang.String with,
java.util.List<java.lang.String> strings)
public static Execed rootUtility(java.lang.String... command) throws java.io.IOException
as - command - java.io.IOExceptionpublic static Execed rootUtility(java.lang.Iterable<java.lang.String> command) throws java.io.IOException
as - command - java.io.IOExceptionpublic static Execed utility(java.lang.String... command) throws java.io.IOException
as - command - java.io.IOExceptionpublic static Execed utility(java.lang.Iterable<java.lang.String> command) throws java.io.IOException
as - command - java.io.IOExceptionpublic static Execed utilityAs(java.lang.String as, java.lang.String... command) throws java.io.IOException
as - command - java.io.IOExceptionpublic static Execed utilityAs(java.lang.String as, java.lang.Iterable<java.lang.String> command) throws java.io.IOException
as - command - java.io.IOExceptionpublic static Execed appAs(java.lang.String as, java.lang.String... command) throws java.io.IOException
as - command - java.io.IOExceptionpublic static Execed appAs(java.lang.String as, java.lang.Iterable<java.lang.String> command) throws java.io.IOException
as - command - java.io.IOExceptionCopyright © 2014. All Rights Reserved.