Package gda.util
Class OSCommandRunner
java.lang.Object
gda.util.OSCommandRunner
- All Implemented Interfaces:
Serializable
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOSCommandRunner(String[] _commands, boolean _keepOutput, String stdInFileName, String stdOutFileName) OSCommandRunner(String command, boolean _keepOutput, String stdInFileName, String stdOutFileName) OSCommandRunner(List<String> _commands, boolean _keepOutput, Object stdInFile, String stdOutFileName) OSCommandRunner(List<String> _commands, boolean _keepOutput, Object stdInFile, String stdOutFileName, Map<? extends String, ? extends String> envPutAll, List<String> envRemove) OSCommandRunner(List<String> _commands, boolean _keepOutput, Object stdInFile, String stdOutFileName, Map<? extends String, ? extends String> envPutAll, List<String> envRemove, String directory) OSCommandRunner(List<String> _commands, boolean _keepOutput, Object stdInFile, String stdOutFileName, Map<? extends String, ? extends String> envPutAll, List<String> envRemove, String directory, int timeoutInMs) Starts process, waits for completion. -
Method Summary
Modifier and TypeMethodDescriptionvoidPrint the output to the logger.static voidrunNoWait(String[] _commands, OSCommandRunner.LOGOPTION logOption, String stdInFileName) static voidrunNoWait(String command, OSCommandRunner.LOGOPTION logOption, String stdInFileName) static voidrunNoWait(List<String> _commands, OSCommandRunner.LOGOPTION logOption, String stdInFileName) static voidrunNoWait(List<String> _commands, OSCommandRunner.LOGOPTION logOption, String stdInFileName, ExecutorService executor) static voidrunNoWait(List<String> _commands, OSCommandRunner.LOGOPTION logOption, String stdInFileName, Map<? extends String, ? extends String> envPutAll, List<String> envRemove)
-
Field Details
-
exitValue
-
exception
-
succeeded
-
commands
-
keepOutput
public final boolean keepOutput
-
-
Constructor Details
-
OSCommandRunner
-
OSCommandRunner
-
OSCommandRunner
-
OSCommandRunner
-
OSCommandRunner
-
OSCommandRunner
public OSCommandRunner(List<String> _commands, boolean _keepOutput, Object stdInFile, String stdOutFileName, Map<? extends String, ? extends String> envPutAll, List<String> envRemove, String directory, int timeoutInMs) Starts process, waits for completion.- Parameters:
_commands- - this is the program and list of arguments_keepOutput- - true if output is to be later accessed in outputLinesstdInFile- - if not null stdin is set to this file. Can be a string for the file path or a list of strings for the lines of the file.stdOutFileName- - if not null stdout is set to this file.
-
-
Method Details
-
getOutputLines
-
runNoWait
public static void runNoWait(String command, OSCommandRunner.LOGOPTION logOption, String stdInFileName) -
runNoWait
public static void runNoWait(String[] _commands, OSCommandRunner.LOGOPTION logOption, String stdInFileName) -
runNoWait
public static void runNoWait(List<String> _commands, OSCommandRunner.LOGOPTION logOption, String stdInFileName) -
runNoWait
public static void runNoWait(List<String> _commands, OSCommandRunner.LOGOPTION logOption, String stdInFileName, ExecutorService executor) -
runNoWait
-
getCommandAsString
-
logOutput
public void logOutput()Print the output to the logger.
-