Package org.wildfly.plugin.provision
Class ExecUtil
- java.lang.Object
-
- org.wildfly.plugin.provision.ExecUtil
-
public class ExecUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description ExecUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddestroyProcess(Process process)Kill the process, if still alive, kill it forciblystatic booleanexec(OutputStream out, File directory, String command, String... args)Execute the specified command from within the specified directory.static booleanexec(OutputStream out, String command, String... args)Execute the specified command from within the current directory.static booleanexec(org.apache.maven.plugin.logging.Log log, File directory, String command, String... args)Execute the specified command from within the specified directory.static booleanexec(org.apache.maven.plugin.logging.Log log, String command, String... args)Execute the specified command from within the current directory.static booleanexecSilentWithTimeout(Duration timeout, String command, String... args)Execute silently the specified command until the given timeout from within the current directory.static booleanexecWithTimeout(org.apache.maven.plugin.logging.Log log, File directory, Duration timeout, String command, String... args)Execute the specified command until the given timeout from within the specified directory.static StringresolveImageBinary()Resolves which image binary to use.static ProcessstartProcess(File directory, String command, String... args)Start a process executing given command with arguments within the specified directory.
-
-
-
Method Detail
-
exec
public static boolean exec(org.apache.maven.plugin.logging.Log log, String command, String... args)Execute the specified command from within the current directory.- Parameters:
command- The commandargs- The command arguments- Returns:
- true if commands where executed successfully
-
exec
public static boolean exec(OutputStream out, String command, String... args)
Execute the specified command from within the current directory.- Parameters:
out- the output stream used to consume the console outputcommand- The commandargs- The command arguments- Returns:
- true if commands where executed successfully
-
execSilentWithTimeout
public static boolean execSilentWithTimeout(Duration timeout, String command, String... args)
Execute silently the specified command until the given timeout from within the current directory.- Parameters:
timeout- The timeoutcommand- The commandargs- The command arguments- Returns:
- true if commands where executed successfully
-
exec
public static boolean exec(org.apache.maven.plugin.logging.Log log, File directory, String command, String... args)Execute the specified command from within the specified directory. The method allows specifying an output filter that processes the command output.- Parameters:
directory- The directorycommand- The commandargs- The command arguments- Returns:
- true if commands where executed successfully
-
exec
public static boolean exec(OutputStream out, File directory, String command, String... args)
Execute the specified command from within the specified directory. The method allows specifying an output filter that processes the command output.- Parameters:
out- the output stream used to consume the console outputdirectory- The directorycommand- The commandargs- The command arguments- Returns:
- true if commands where executed successfully
-
execWithTimeout
public static boolean execWithTimeout(org.apache.maven.plugin.logging.Log log, File directory, Duration timeout, String command, String... args)Execute the specified command until the given timeout from within the specified directory. The method allows specifying an output filter that processes the command output.- Parameters:
directory- The directorytimeout- The timeoutcommand- The commandargs- The command arguments- Returns:
- true if commands where executed successfully
-
startProcess
public static Process startProcess(File directory, String command, String... args)
Start a process executing given command with arguments within the specified directory.- Parameters:
directory- The directorycommand- The commandargs- The command arguments- Returns:
- the process
-
destroyProcess
public static void destroyProcess(Process process)
Kill the process, if still alive, kill it forcibly- Parameters:
process- the process to kill
-
resolveImageBinary
public static String resolveImageBinary()
Resolves which image binary to use. Firstdockeris tried. If docker does not exist, thenpodmanis tried. If podman does not existnullis returned.- Returns:
- the resolved binary, or
nullif docker or podman was not found
-
-