Class ExecUtil


  • public class ExecUtil
    extends Object
    • Constructor Detail

      • ExecUtil

        public ExecUtil()
    • Method Detail

      • exec

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

        public static boolean execSilent​(String command,
                                         String... args)
        Execute the specified command from within the current directory and hide the output.
        Parameters:
        command - The command
        args - 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 directory
        command - The command
        args - The command arguments
        Returns:
        true if commands where executed successfully
      • execSilent

        public static boolean execSilent​(File directory,
                                         String command,
                                         String... args)
        Execute the specified command from within the specified directory and hide the output.
        Parameters:
        directory - The directory
        command - The command
        args - 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 directory
        outputFilterFunction - A Function that gets an InputStream and returns an outputFilter.
        command - The command
        args - The command arguments
        Returns:
        true if commands where executed successfully