public class Exec extends Object
| Constructor and Description |
|---|
Exec(Iterable<String> command) |
Exec(String... command) |
| Modifier and Type | Method and Description |
|---|---|
static Execed |
appAs(String as,
Iterable<String> command)
Runs a command, optionally executing as a different user (eg root)
|
static Execed |
appAs(String as,
String... command)
Runs a command, optionally executing as a different user (eg root)
|
String |
getEnv(String key) |
ProcessBuilder |
getProcessBuilder()
Returns a ProcessBuilder for use in a manual launching
|
boolean |
getRedirectError() |
File |
getWorkingDirectory() |
protected static String |
join(String with,
List<String> strings) |
protected static String |
join(String with,
String... strings) |
static Execed |
rootUtility(Iterable<String> command)
Runs a command in "utility" mode: redirecting stderr to stdout and running as root
|
static Execed |
rootUtility(String... command)
Runs a command in "utility" mode: redirecting stderr to stdout and running as root
|
Exec |
runAs(String username) |
Exec |
runAsSuperuser() |
Exec |
setEnv(String key,
String value) |
Exec |
setRedirectError(boolean value) |
Exec |
setWorkingDirectory(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 |
ProcessBuilder |
startManually()
Deprecated.
|
static Execed |
utility(Iterable<String> command)
Runs a command in "utility" mode: redirecting stderr to stdout and optionally executing as a different user (eg root)
|
static Execed |
utility(String... command)
Runs a command in "utility" mode: redirecting stderr to stdout and optionally executing as a different user (eg root)
|
static Execed |
utilityAs(String as,
Iterable<String> command)
Runs a command in "utility" mode: redirecting stderr to stdout and optionally executing as a different user (eg root)
|
static Execed |
utilityAs(String as,
String... command)
Runs a command in "utility" mode: redirecting stderr to stdout and optionally executing as a different user (eg root)
|
public File getWorkingDirectory()
public Exec runAsSuperuser()
public boolean getRedirectError()
public Exec setRedirectError(boolean value)
public BaseExeced startBasic() throws IOException
IOExceptionpublic Execed start() throws IOException
IOException@Deprecated public ProcessBuilder startManually()
public ProcessBuilder getProcessBuilder()
public static Execed rootUtility(String... command) throws IOException
as - command - IOExceptionpublic static Execed rootUtility(Iterable<String> command) throws IOException
as - command - IOExceptionpublic static Execed utility(String... command) throws IOException
as - command - IOExceptionpublic static Execed utility(Iterable<String> command) throws IOException
as - command - IOExceptionpublic static Execed utilityAs(String as, String... command) throws IOException
as - command - IOExceptionpublic static Execed utilityAs(String as, Iterable<String> command) throws IOException
as - command - IOExceptionpublic static Execed appAs(String as, String... command) throws IOException
as - command - IOExceptionpublic static Execed appAs(String as, Iterable<String> command) throws IOException
as - command - IOExceptionCopyright © 2014. All rights reserved.