Class ShellCommandExecutor

java.lang.Object
com.suse.common.io.process.ShellCommandExecutor

public class ShellCommandExecutor extends Object
  • Field Details

    • LOGGER

      private static final org.apache.logging.log4j.Logger LOGGER
    • runtime

      private final Runtime runtime
    • lastExecutedCommand

      protected String lastExecutedCommand
  • Constructor Details

    • ShellCommandExecutor

      public ShellCommandExecutor()
      Constructor
  • Method Details

    • getLastExecutedCommand

      public String getLastExecutedCommand()
      Gets the last executed command
      Returns:
      the last executed command string
    • executeProcess

      public ProcessOutput executeProcess(String... command) throws ExecutionException
      Executes a command in a process
      Parameters:
      command - list of strings to be joined as a command
      Returns:
      a process output object
      Throws:
      ExecutionException - if anything goes wrong
    • getOutput

      private String getOutput(InputStream stream, String logPrefix) throws IOException
      Throws:
      IOException