java.lang.Object
org.variantsync.studies.evolution.simulation.shell.ShellExecutor

public class ShellExecutor extends Object
Class for executing shell commands under Linux
  • Constructor Details

    • ShellExecutor

      public ShellExecutor(Consumer<String> outputReader, Consumer<String> errorReader)
      Initialize a new ShellExecutor
      Parameters:
      outputReader - Consumer for shell's normal output
      errorReader - Consumer for shell's error output
    • ShellExecutor

      public ShellExecutor(Consumer<String> outputReader, Consumer<String> errorReader, Path workDir)
      Initialize a new ShellExecutor that executes all commands in the given working directory
      Parameters:
      outputReader - Consumer for shell's normal output
      errorReader - Consumer for shell's error output
      workDir - The working directory
  • Method Details

    • execute

      public org.variantsync.functjonal.Result<List<String>,ShellException> execute(ShellCommand command)
      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 execute
      executionDir - The directory in which to execute the command
      Returns:
      A result that depends on the commands exit code