Class ProcUtils
java.lang.Object
org.opendaylight.ovsdb.utils.ovsdb.it.utils.ProcUtils
Run subprocesses and log or return their output.
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
runProcess
(int reserved, long waitFor, StringBuilder capturedStdout, String... words) static void
runProcess
(long waitFor, String... words) Run a process and assert the exit code is 0.static void
runProcess
(long waitFor, StringBuilder capturedStdout, String... words) Run a process, collect the stdout, and assert the exit code is 0.static int
tryProcess
(String logText, long waitFor, String... words) Run a process.static int
tryProcess
(String logText, long waitFor, StringBuilder capturedStdout, String... words) Run a process, collect the stdout.
-
Method Details
-
runProcess
public static void runProcess(long waitFor, String... words) throws IOException, InterruptedException Run 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, InterruptedException Run 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:
IOException
InterruptedException
-
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
-