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
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
executeCommandLine
(String... commandLine) ExecutescommandLine
.static @Nullable String
executeCommandLineAndWaitResponse
(@Nullable Duration timeout, String... commandLine) ExecutescommandLine
and return its result.
-
Constructor Details
-
ExecUtil
public ExecUtil()
-
-
Method Details
-
executeCommandLine
Executes
commandLine
.A possible
IOException
gets 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
commandLine
and return its result.A possible
IOException
gets 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
null
if a timeout or error occurred
-