Package org.tweetyproject.commons.util
Class NativeShell
java.lang.Object
org.tweetyproject.commons.util.Shell
org.tweetyproject.commons.util.NativeShell
Default shell
- Author:
- Nils Geilen, Matthias Thimm
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
invokeExecutable
(String commandline) Executes the given command on the commandline and returns the complete output.static String
invokeExecutable
(String commandline, long maxLines) invokeExecutablestatic String
invokeExecutable
(String commandline, long maxLines, boolean suppressErrors) Executes the given command on the commandline and returns the output up to a given number of lines.returnMethods inherited from class org.tweetyproject.commons.util.Shell
getCygwinShell, getNativeShell
-
Method Details
-
run
return- Specified by:
run
in classShell
- Parameters:
cmd
- the command to be run- Returns:
- the terminal output
- Throws:
InterruptedException
- if some interruption occurred.IOException
- if some IO issue occurred.
-
invokeExecutable
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
- StringmaxLines
- String- Returns:
- NativeShell
- Throws:
IOException
- throwsInterruptedException
- 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 commandmaxLines
- 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.
-