Package io.quarkus.deployment.util
Class ExecUtil
- java.lang.Object
-
- io.quarkus.deployment.util.ExecUtil
-
public class ExecUtil extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static Function<InputStream,Runnable>
DEBUG_LOGGING
static Function<InputStream,Runnable>
INFO_LOGGING
static Function<InputStream,Runnable>
SYSTEM_LOGGING
-
Constructor Summary
Constructors Constructor Description ExecUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
destroyProcess(Process process)
Kill the process, if still alive, kill it forciblystatic boolean
exec(File directory, String command, String... args)
Execute the specified command from within the specified directory.static boolean
exec(File directory, Function<InputStream,Runnable> outputFilterFunction, String command, String... args)
Execute the specified command from within the specified directory.static boolean
exec(String command, String... args)
Execute the specified command from within the current directory.static boolean
execWithDebugLogging(File directory, String command, String... args)
Execute the specified command from within the specified directory using debug logging.static boolean
execWithDebugLogging(String command, String... args)
Execute the specified command from within the current directory using debug logging.static boolean
execWithSystemLogging(File directory, String command, String... args)
Execute the specified command from within the specified directory using system logging.static boolean
execWithSystemLogging(String command, String... args)
Execute the specified command from within the current directory using system logging.static boolean
execWithTimeout(File directory, Duration timeout, String command, String... args)
Execute the specified command until the given timeout from within the specified directory.static boolean
execWithTimeout(File directory, Function<InputStream,Runnable> outputFilterFunction, Duration timeout, String command, String... args)
Execute the specified command until the given timeout from within the specified directory.static boolean
execWithTimeout(Duration timeout, String command, String... args)
Execute the specified command until the given timeout from within the current directory.static Process
startProcess(File directory, String command, String... args)
Start a process executing given command with arguments within the specified directory.
-
-
-
Field Detail
-
INFO_LOGGING
public static final Function<InputStream,Runnable> INFO_LOGGING
-
DEBUG_LOGGING
public static final Function<InputStream,Runnable> DEBUG_LOGGING
-
SYSTEM_LOGGING
public static final Function<InputStream,Runnable> SYSTEM_LOGGING
-
-
Method Detail
-
exec
public static boolean exec(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
-
execWithTimeout
public static boolean execWithTimeout(Duration timeout, String command, String... args)
Execute 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(File directory, String command, String... args)
Execute the specified command from within the specified directory.- Parameters:
directory
- The directorycommand
- The commandargs
- The command arguments- Returns:
- true if commands where executed successfully
-
execWithTimeout
public static boolean execWithTimeout(File directory, Duration timeout, String command, String... args)
Execute the specified command until the given timeout from within the specified directory.- Parameters:
directory
- The directorytimeout
- The timeoutcommand
- The commandargs
- The command arguments- Returns:
- true if commands where executed successfully
-
exec
public static boolean exec(File directory, Function<InputStream,Runnable> outputFilterFunction, 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 directoryoutputFilterFunction
- AFunction
that gets anInputStream
and returns an outputFilter.command
- The commandargs
- The command arguments- Returns:
- true if commands where executed successfully
-
execWithTimeout
public static boolean execWithTimeout(File directory, Function<InputStream,Runnable> outputFilterFunction, 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 directoryoutputFilterFunction
- AFunction
that gets anInputStream
and returns an outputFilter.timeout
- The timeoutcommand
- The commandargs
- The command arguments- Returns:
- true if commands where executed successfully
-
execWithDebugLogging
public static boolean execWithDebugLogging(String command, String... args)
Execute the specified command from within the current directory using debug logging.- Parameters:
command
- The commandargs
- The command arguments- Returns:
- true if commands where executed successfully
-
execWithDebugLogging
public static boolean execWithDebugLogging(File directory, String command, String... args)
Execute the specified command from within the specified directory using debug logging.- Parameters:
directory
- The directorycommand
- The commandargs
- The command arguments- Returns:
- true if commands where executed successfully
-
execWithSystemLogging
public static boolean execWithSystemLogging(String command, String... args)
Execute the specified command from within the current directory using system logging.- Parameters:
command
- The commandargs
- The command arguments- Returns:
- true if commands where executed successfully
-
execWithSystemLogging
public static boolean execWithSystemLogging(File directory, String command, String... args)
Execute the specified command from within the specified directory using system logging.- Parameters:
directory
- The directorycommand
- 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
-
-