private void handleForkedProcessSignal(Socket accept) throws IOException {
    // the stream can not be closed in the current thread
    DataInputStream stream = new DataInputStream(accept.getInputStream());

    String debuggerId = stream.readUTF();
    String processName = stream.readUTF();
    String processParameters = stream.readUTF();

    if (ExternalSystemTaskDebugRunner.LOG.isDebugEnabled()) {
      String productName = ApplicationNamesInfo.getInstance().getFullProductName();
      String logMessage = "%s received debug process signal ID='%s', PROC_NAME='%s', PARAMS='%s'";
      ExternalSystemTaskDebugRunner.LOG.debug(String.format(logMessage, productName, debuggerId, processName, processParameters));
    }

    if (processParameters.startsWith(ForkedDebuggerHelper.FINISH_PARAMS)) {
      removeTerminatedForks(processName, accept, stream);
      return;
    }

    myMainProcessHandler.addProcessListener(new ProcessAdapter() {
      @Override
      public void processTerminated(@NotNull ProcessEvent event) {
        StreamUtil.closeStream(stream);
        StreamUtil.closeStream(accept);
      }
    });

    attachRemoteDebugger(debuggerId, processName, processParameters, accept, stream);
  }
private void handleForkedProcessSignal(Socket accept)