Class RunCommand


  • public class RunCommand
    extends Object
    Class providing the run(List, Path, long) method to run a command in a separate process with a timeout.
    • Constructor Detail

      • RunCommand

        public RunCommand()
    • Method Detail

      • run

        static RunCommand.Status run​(List<String> command,
                                     Path workingDirectory,
                                     long timeoutMillis)
                              throws RunCommand.CommandException
        Runs the given command synchronously in the given directory using the given timeout. If the command completes normally, returns a RunCommand.Status object capturing the command, exit status, and output from the process.
        Parameters:
        command - the command to be run in the process
        workingDirectory - the working directory for the command
        timeoutMillis - the timeout in milliseconds for executing the process
        Returns:
        the RunCommand.Status capturing the outcome of executing the command
        Throws:
        RunCommand.CommandException - if there is an error running the command