Class ProcUtils
- java.lang.Object
-
- org.opendaylight.ovsdb.utils.ovsdb.it.utils.ProcUtils
-
public final class ProcUtils extends Object
Run subprocesses and log or return their output.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intrunProcess(int reserved, long waitFor, StringBuilder capturedStdout, String... words)static voidrunProcess(long waitFor, String... words)Run a process and assert the exit code is 0.static voidrunProcess(long waitFor, StringBuilder capturedStdout, String... words)Run a process, collect the stdout, and assert the exit code is 0.static inttryProcess(String logText, long waitFor, String... words)Run a process.static inttryProcess(String logText, long waitFor, StringBuilder capturedStdout, String... words)Run a process, collect the stdout.
-
-
-
Method Detail
-
runProcess
public static void runProcess(long waitFor, String... words) throws IOException, InterruptedExceptionRun a process and assert the exit code is 0.- Parameters:
waitFor- How long to wait for the command to executewords- The words of the command to run- Throws:
IOException- if something goes wrong on the IO endInterruptedException- If this thread is interrupted
-
runProcess
public static void runProcess(long waitFor, StringBuilder capturedStdout, String... words) throws IOException, InterruptedExceptionRun a process, collect the stdout, and assert the exit code is 0.- Parameters:
waitFor- How long to wait for the command to executecapturedStdout- Whatever the process wrote to standard outwords- The words of the command to run- Throws:
IOException- if something goes wrong on the IO endInterruptedException- If this thread is interrupted
-
runProcess
public static int runProcess(int reserved, long waitFor, StringBuilder capturedStdout, String... words) throws IOException, InterruptedException- Throws:
IOExceptionInterruptedException
-
tryProcess
public static int tryProcess(String logText, long waitFor, String... words) throws IOException, InterruptedException
Run a process.- Parameters:
waitFor- How long to wait for the command to executewords- The words of the command to run- Returns:
- The process's exit code
- Throws:
IOException- if something goes wrong on the IO endInterruptedException- If this thread is interrupted
-
tryProcess
public static int tryProcess(String logText, long waitFor, StringBuilder capturedStdout, String... words) throws IOException, InterruptedException
Run a process, collect the stdout.- Parameters:
waitFor- How long to wait (milliseconds) for the command to executecapturedStdout- Whatever the process wrote to standard outwords- The words of the command to run- Returns:
- The process's exit code or -1 if the the command does not complete within waitFor milliseconds
- Throws:
IOException- if something goes wrong on the IO endInterruptedException- If this thread is interrupted
-
-