@WorkerThread
    public synchronized CommandResult run(String... commands) {
      isCommandRunning = true;
      if (wantStderr) {
        stderr = Collections.synchronizedList(new ArrayList<String>());
      } else {
        stderr = Collections.emptyList();
      }
      shell.addCommand(commands, 0, commandResultListener);
      waitForCommandFinished();
      CommandResult result = new CommandResult(stdout, stderr, exitCode);
      stderr = null;
      stdout = null;
      return result;
    }
Executes the commands in the shell and wait for its termination and return the result.

@param commands
    The commands to execute.
@return The {@link CommandResult}.
imitate/src/main/java/com/engineer/imitate/shell/Shell.java