Class NativeShell

java.lang.Object
org.tweetyproject.commons.util.Shell
org.tweetyproject.commons.util.NativeShell

public class NativeShell extends Shell
Default shell
Author:
Nils Geilen, Matthias Thimm
  • Method Details

    • run

      public String run(String cmd) throws InterruptedException, IOException
      return
      Specified by:
      run in class Shell
      Parameters:
      cmd - the command to be run
      Returns:
      the terminal output
      Throws:
      InterruptedException - if some interruption occurred.
      IOException - if some IO issue occurred.
    • invokeExecutable

      public static String invokeExecutable(String commandline) throws IOException, InterruptedException
      Executes the given command on the commandline and returns the complete output.
      Parameters:
      commandline - some command
      Returns:
      the output of the execution
      Throws:
      IOException - of an error was encountered.
      InterruptedException - if some interruption occurred.
    • invokeExecutable

      public static String invokeExecutable(String commandline, long maxLines) throws IOException, InterruptedException
      invokeExecutable
      Parameters:
      commandline - String
      maxLines - String
      Returns:
      NativeShell
      Throws:
      IOException - throws
      InterruptedException - throws
    • invokeExecutable

      public static String invokeExecutable(String commandline, long maxLines, boolean suppressErrors) throws IOException, InterruptedException
      Executes the given command on the commandline and returns the output up to a given number of lines.
      Parameters:
      commandline - some command
      maxLines - the maximum number of lines to be read (the process is killed afterwards)
      suppressErrors - if set to true, possible errors will not be included in the output
      Returns:
      the output of the execution
      Throws:
      IOException - of an error was encountered.
      InterruptedException - if some interruption occurred.