Class TerminalUtility
java.lang.Object
io.github.eggy03.dmidecode.utility.TerminalUtility
A utility class that provides a way to launch a terminal session
Mostly for internal use
- Since:
- 0.1.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull StringexecuteCommand(@NonNull String command, long timeoutSeconds) Launches a standalone terminal session, executes the given command and returns the result
-
Field Details
-
log
private static final org.slf4j.Logger log
-
-
Constructor Details
-
TerminalUtility
private TerminalUtility()
-
-
Method Details
-
executeCommand
Launches a standalone terminal session, executes the given command and returns the result- Parameters:
command- The command/script to be executed in the terminaltimeoutSeconds- 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, or when the terminal cannot be accessed.IllegalArgumentException- If the provided timeout is in the negative
-