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 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 execute
      words - The words of the command to run
      Throws:
      IOException - if something goes wrong on the IO end
      InterruptedException - 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 execute
      capturedStdout - Whatever the process wrote to standard out
      words - The words of the command to run
      Throws:
      IOException - if something goes wrong on the IO end
      InterruptedException - 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 execute
      words - The words of the command to run
      Returns:
      The process's exit code
      Throws:
      IOException - if something goes wrong on the IO end
      InterruptedException - 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 execute
      capturedStdout - Whatever the process wrote to standard out
      words - 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 end
      InterruptedException - If this thread is interrupted