Class TerminalUtility

java.lang.Object
io.github.eggy03.ferrumx.windows.utility.TerminalUtility

public class TerminalUtility extends Object
A utility class that provides an alternative way to launch a PowerShell session without jPowerShell

Mostly for internal use

Since:
3.1.0
  • Constructor Details

    • TerminalUtility

      public TerminalUtility()
  • Method Details

    • executeCommand

      @NotNull public static @NotNull String executeCommand(@NonNull @NonNull String command, long timeoutSeconds)
      Launches a standalone PowerShell session and executes commands and returns the result
      Parameters:
      command - The command to be executed in the PowerShell
      timeoutSeconds - Time in seconds after which the session will be force stopped
      Returns:
      The result of the command executed
      Throws:
      TerminalExecutionException - When the process is killed pre-maturely upon reaching the timeout or when the command yields an error
      IllegalArgumentException - If the provided timeout is in the negative