def _spawn_nailgun_server(self, fingerprint, jvm_options, classpath, stdout, stderr, stdin):
    """Synchronously spawn a new nailgun server."""
    # Truncate the nailguns stdout & stderr.
    safe_file_dump(self._ng_stdout, b'', mode='wb')
    safe_file_dump(self._ng_stderr, b'', mode='wb')

    jvm_options = jvm_options + [self._PANTS_NG_BUILDROOT_ARG,
                                 self._create_owner_arg(self._workdir),
                                 self._create_fingerprint_arg(fingerprint)]

    post_fork_child_opts = dict(fingerprint=fingerprint,
                                jvm_options=jvm_options,
                                classpath=classpath,
                                stdout=stdout,
                                stderr=stderr)

    logger.debug('Spawning nailgun server {i} with fingerprint={f}, jvm_options={j}, classpath={cp}'
                 .format(i=self._identity, f=fingerprint, j=jvm_options, cp=classpath))

    self.daemon_spawn(post_fork_child_opts=post_fork_child_opts)

    # Wait for and write the port information in the parent so we can bail on exception/timeout.
    self.await_pid(self._startup_timeout)
    self.write_socket(self._await_socket(self._connect_timeout))

    logger.debug('Spawned nailgun server {i} with fingerprint={f}, pid={pid} port={port}'
                 .format(i=self._identity, f=fingerprint, pid=self.pid, port=self.socket))

    client = self._create_ngclient(self.socket, stdout, stderr, stdin)
    self.ensure_connectable(client)

    return client
Synchronously spawn a new nailgun server.