public class Exec extends Object
Constructor | Description |
---|---|
Exec(Iterable<String> command) |
|
Exec(String... command) |
Modifier and Type | Method | 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,
String... strings) |
|
protected static String |
join(String with,
List<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 |
BasicProcessTracker |
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 |
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 BasicProcessTracker startBasic() throws IOException
IOException
public Execed start() throws IOException
IOException
public ProcessBuilder getProcessBuilder()
public static Execed rootUtility(String... command) throws IOException
command
- IOException
public static Execed rootUtility(Iterable<String> command) throws IOException
command
- IOException
public static Execed utility(String... command) throws IOException
command
- IOException
public static Execed utility(Iterable<String> command) throws IOException
command
- IOException
public static Execed utilityAs(String as, String... command) throws IOException
as
- command
- IOException
public static Execed utilityAs(String as, Iterable<String> command) throws IOException
as
- command
- IOException
public static Execed appAs(String as, String... command) throws IOException
as
- command
- IOException
public static Execed appAs(String as, Iterable<String> command) throws IOException
as
- command
- IOException
Copyright © 2018. All rights reserved.