void (final OSProcessHandler handler) { handler.addProcessListener(new ProcessAdapter() { @Override public void processTerminated(@NotNull final ProcessEvent event) { handler.removeProcessListener(this); ensureFinished(); } @Override public void startNotified(@NotNull final ProcessEvent event) { startSearch(); } }); }