Package org.openhab.core.io.net.exec
Class ExecUtil
java.lang.Object
org.openhab.core.io.net.exec.ExecUtil
Some common methods to execute commands on command line.
- Author:
- Pauli Anttila - Initial contribution, Kai Kreuzer - added exception logging, Connor Petty - replaced delimiter usage with argument array
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidexecuteCommandLine(String... commandLine) ExecutescommandLine.static @Nullable StringexecuteCommandLineAndWaitResponse(@Nullable Duration timeout, String... commandLine) ExecutescommandLineand return its result.
-
Constructor Details
-
ExecUtil
public ExecUtil()
-
-
Method Details
-
executeCommandLine
Executes
commandLine.A possible
IOExceptiongets logged but no further processing is done.- Parameters:
commandLine- the command line to execute
-
executeCommandLineAndWaitResponse
public static @Nullable String executeCommandLineAndWaitResponse(@Nullable Duration timeout, String... commandLine) Executes
commandLineand return its result.A possible
IOExceptiongets logged but no further processing is done.- Parameters:
timeout- the max time to wait for a process to finish, null to wait indefinitelycommandLine- the command line to execute- Returns:
- response data from executed command line or
nullif a timeout or error occurred
-