Package org.verifyica.api
Class ShellScript
java.lang.Object
org.verifyica.api.ShellScript
Utility class for executing shell scripts using various Unix shells.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classResult class to encapsulate the result of executing a shell script.static enumEnum representing supported Unix shells. -
Method Summary
Modifier and TypeMethodDescriptionstatic ShellScript.ResultExecute a shell script using the specified shell in a given working directory.static ShellScript.Resultexecute(ShellScript.Shell shell, Path script, Consumer<String> consumer) Execute a shell script using the specified shell in the current working directory.
-
Method Details
-
execute
public static ShellScript.Result execute(ShellScript.Shell shell, Path script, Consumer<String> consumer) Execute a shell script using the specified shell in the current working directory.- Parameters:
shell- shell to use (e.g., BASH)script- the shell scriptconsumer- consumer to handle each line of output- Returns:
- result with exit code and optional error
-
execute
public static ShellScript.Result execute(ShellScript.Shell shell, Path workingDirectory, Path script, Consumer<String> consumer) Execute a shell script using the specified shell in a given working directory.- Parameters:
shell- shell to use (e.g., BASH)workingDirectory- the directory to run the script in, or null for defaultscript- the shell scriptconsumer- consumer to handle each line of output- Returns:
- result with exit code and optional error
-