private void handleStream(final InputStream in, final ByteArrayOutputStream out, @NotNull @NonNls String cmd) {
    Thread t = new Thread(() -> {
      try {
        byte[] buffer = new byte[BUFFER_SIZE];
        while (true) {
          int rc = in.read(buffer);
          if (rc == -1) {
            break;
          }
          out.write(buffer, 0, rc);
        }
      }
      catch (IOException e) {
        if (!myException.compareAndSet(null, new VcsException(GitBundle.message("git.error.cant.process.output", e.getLocalizedMessage()), e))) {
          LOG.error("Problem reading stream", e);
        }
      }
      finally {
        mySteamSemaphore.release(1);
      }
    }, cmd);
    t.setDaemon(true);
    t.start();
  }
private void handleStream(final InputStream in, final ByteArrayOutputStream out, @NotNull @NonNls String cmd)