def _extract_remote_exception(self, pantsd_pid, nailgun_error):
    """Given a NailgunError, returns a Terminated exception with additional info (where possible).

    This method will include the entire exception log for either the `pid` in the NailgunError, or
    failing that, the `pid` of the pantsd instance.
    """
    sources = [pantsd_pid]
    if nailgun_error.pid is not None:
      sources = [abs(nailgun_error.pid)] + sources

    exception_text = None
    for source in sources:
      log_path = ExceptionSink.exceptions_log_path(for_pid=source)
      exception_text = maybe_read_file(log_path)
      if exception_text:
        break

    exception_suffix = '\nRemote exception:\n{}'.format(exception_text) if exception_text else ''
    return self.Terminated('abruptly lost active connection to pantsd runner: {!r}{}'.format(
      nailgun_error, exception_suffix))
def _extract_remote_exception ( self , pantsd_pid , nailgun_error ) : sources = [ pantsd_pid ] if nailgun_error . pid is not None : sources = [ abs ( nailgun_error . pid ) ] + sources exception_text = None for source in sources : log_path = ExceptionSink . exceptions_log_path ( for_pid = source ) exception_text = maybe_read_file ( log_path ) if exception_text : break exception_suffix = '\nRemote exception:\n{}' . format ( exception_text ) if exception_text else '' return self . Terminated ( 'abruptly lost active connection to pantsd runner: {!r}{}' . format ( nailgun_error , exception_suffix ) )
Given a NailgunError, returns a Terminated exception with additional info (where possible).

    This method will include the entire exception log for either the `pid` in the NailgunError, or
    failing that, the `pid` of the pantsd instance.