@Override
    public void addTerminationCallback(@NotNull Runnable onTerminated, @NotNull Disposable parentDisposable) {
      TerminalWidgetListener listener = new TerminalWidgetListener() {
        @Override
        public void allSessionsClosed(com.jediterm.terminal.ui.TerminalWidget widget) {
          onTerminated.run();
        }
      };
      widget().addListener(listener);
      Disposer.register(parentDisposable, () -> {
        widget().removeListener(listener);
      });
    }
@Override
    public void addTerminationCallback(@NotNull Runnable onTerminated, @NotNull Disposable parentDisposable)