Class ShellExecutor
java.lang.Object
org.variantsync.studies.evolution.simulation.shell.ShellExecutor
Class for executing shell commands under Linux
-
Constructor Summary
ConstructorsConstructorDescriptionShellExecutor
(Consumer<String> outputReader, Consumer<String> errorReader) Initialize a new ShellExecutorInitialize a new ShellExecutor that executes all commands in the given working directory -
Method Summary
Modifier and TypeMethodDescriptionorg.variantsync.functjonal.Result<List<String>,
ShellException> execute
(ShellCommand command) Execute the given commandorg.variantsync.functjonal.Result<List<String>,
ShellException> execute
(ShellCommand command, Path executionDir) Execute the given command.
-
Constructor Details
-
ShellExecutor
Initialize a new ShellExecutor- Parameters:
outputReader
- Consumer for shell's normal outputerrorReader
- Consumer for shell's error output
-
ShellExecutor
Initialize a new ShellExecutor that executes all commands in the given working directory- Parameters:
outputReader
- Consumer for shell's normal outputerrorReader
- Consumer for shell's error outputworkDir
- The working directory
-
-
Method Details
-
execute
Execute the given command- Returns:
- A result that depends on the commands exit code
-
execute
public org.variantsync.functjonal.Result<List<String>,ShellException> execute(ShellCommand command, Path executionDir) Execute the given command.- Parameters:
command
- The command to executeexecutionDir
- The directory in which to execute the command- Returns:
- A result that depends on the commands exit code
-