Class ExecUtil

java.lang.Object
org.wildfly.glow.ExecUtil

public class ExecUtil extends Object
  • Constructor Details

    • ExecUtil

      public ExecUtil()
  • Method Details

    • exec

      public static boolean exec(String command, GlowMessageWriter writer, String... args)
      Execute the specified command from within the current directory.
      Parameters:
      command - The command
      writer -
      args - The command arguments
      Returns:
      true if commands where executed successfully
    • execSilentWithTimeout

      public static boolean execSilentWithTimeout(Duration timeout, String command, GlowMessageWriter writer, String... args)
      Execute silently the specified command until the given timeout from within the current directory.
      Parameters:
      timeout - The timeout
      command - The command
      writer -
      args - The command arguments
      Returns:
      true if commands where executed successfully
    • exec

      public static boolean exec(File directory, String command, GlowMessageWriter writer, 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 directory
      command - The command
      writer -
      args - The command arguments
      Returns:
      true if commands where executed successfully
    • execWithTimeout

      public static boolean execWithTimeout(File directory, Duration timeout, String command, GlowMessageWriter writer, 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 directory
      timeout - The timeout
      command - The command
      writer -
      args - 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 directory
      command - The command
      args - 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(GlowMessageWriter writer)
      Resolves which image binary to use.First docker is tried. If docker does not exist, then podman is tried. If podman does not exist null is returned.
      Parameters:
      writer -
      Returns:
      the resolved binary, or null if docker or podman was not found