public int execute(final InterruptibleProcess worker, final long timeout) throws IOException, ExecutionException, TimeoutException, InterruptedException {
    myErrStreamListener = createStreamListener(worker.getErrorStream());
    myInStreamListener = createStreamListener(worker.getInputStream());

    final Application app = ApplicationManager.getApplication();

    final int rc;
    try {
      Future<?> errorStreamReadingFuture = app.executeOnPooledThread(myErrStreamListener);
      Future<?> outputStreamReadingFuture = app.executeOnPooledThread(myInStreamListener);
      rc = worker.execute();
      if (tryReadStreams(rc)) {
        errorStreamReadingFuture.get(timeout, TimeUnit.MILLISECONDS);
        outputStreamReadingFuture.get(timeout, TimeUnit.MILLISECONDS);
      }
    } finally {
      cancelListeners();
    }

    return rc;
  }
public int execute(final InterruptibleProcess worker, final long timeout)