コード例 #1
0
    def _StopServer(self):
        with self._server_lock:
            if self._ServerIsRunning():
                self._logger.info('Stopping SSVIM server with PID {0}'.format(
                    self._http_phandle.pid))
                self._GetResponse('/shutdown')
                try:
                    utils.WaitUntilProcessIsTerminated(self._http_phandle,
                                                       timeout=5)
                    self._logger.info('SSVIM server stopped')
                except RuntimeError:
                    self._logger.exception('Error while stopping SSVIM server')

                self._CleanUp()
コード例 #2
0
ファイル: jedi_completer.py プロジェクト: nachose/vim_conf
  def _StopServer( self ):
    with self._server_lock:
      if self._ServerIsRunning():
        self._logger.info( 'Stopping JediHTTP server with PID {0}'.format(
                               self._jedihttp_phandle.pid ) )
        self._jedihttp_phandle.terminate()
        try:
          utils.WaitUntilProcessIsTerminated( self._jedihttp_phandle,
                                              timeout = 5 )
          self._logger.info( 'JediHTTP server stopped' )
        except RuntimeError:
          self._logger.exception( 'Error while stopping JediHTTP server' )

      self._CleanUp()
コード例 #3
0
    def _StopServerNoLock(self):
        """ Stop the OmniSharp server using a lock. """
        if self._ServerIsRunning():
            LOGGER.info('Stopping OmniSharp server with PID %s',
                        self._omnisharp_phandle.pid)
            try:
                self._TryToStopServer()
                self._ForceStopServer()
                utils.WaitUntilProcessIsTerminated(self._omnisharp_phandle,
                                                   timeout=5)
                LOGGER.info('OmniSharp server stopped')
            except Exception:
                LOGGER.exception('Error while stopping OmniSharp server')

        self._CleanUp()
コード例 #4
0
ファイル: cs_completer.py プロジェクト: ddcien/ycmd
  def _StopServer( self ):
    """ Stop the OmniSharp server using a lock. """
    with self._server_state_lock:
      if self._ServerIsRunning():
        self._logger.info( 'Stopping OmniSharp server with PID {0}'.format(
                               self._omnisharp_phandle.pid ) )
        self._GetResponse( '/stopserver' )
        try:
          utils.WaitUntilProcessIsTerminated( self._omnisharp_phandle,
                                              timeout = 5 )
          self._logger.info( 'OmniSharp server stopped' )
        except RuntimeError:
          self._logger.exception( 'Error while stopping OmniSharp server' )

      self._CleanUp()
コード例 #5
0
  def _StopServer( self ):
    with self._server_state_mutex:
      _logger.info( 'Shutting down jdt.ls...' )
      # We don't use utils.CloseStandardStreams, because the stdin/out is
      # connected to our server connector. Just close stderr.
      #
      # The other streams are closed by the LanguageServerConnection when we
      # call Close.
      if self._server_handle and self._server_handle.stderr:
        self._server_handle.stderr.close()

      # Tell the connection to expect the server to disconnect
      if self._connection:
        self._connection.Stop()

      if not self._ServerIsRunning():
        _logger.info( 'jdt.ls Language server not running' )
        self._CleanUp()
        return

      _logger.info( 'Stopping java server with PID {0}'.format(
                        self._server_handle.pid ) )

      try:
        self.ShutdownServer()

        # By this point, the server should have shut down and terminated. To
        # ensure that isn't blocked, we close all of our connections and wait
        # for the process to exit.
        #
        # If, after a small delay, the server has not shut down we do NOT kill
        # it; we expect that it will shut itself down eventually. This is
        # predominantly due to strange process behaviour on Windows.
        if self._connection:
          self._connection.Close()

        utils.WaitUntilProcessIsTerminated( self._server_handle,
                                            timeout = 15 )

        _logger.info( 'jdt.ls Language server stopped' )
      except Exception:
        _logger.exception( 'Error while stopping jdt.ls server' )
        # We leave the process running. Hopefully it will eventually die of its
        # own accord.

      # Tidy up our internal state, even if the completer server didn't close
      # down cleanly.
      self._CleanUp()
コード例 #6
0
ファイル: go_completer.py プロジェクト: HusterYP/VimConf
  def _StopServer( self ):
    """Stop the Gocode server."""
    with self._gocode_lock:
      if self._ServerIsRunning():
        _logger.info( 'Stopping Gocode server with PID {0}'.format(
                          self._gocode_handle.pid ) )
        try:
          self._ExecuteCommand( [ self._gocode_binary_path,
                                  '-sock', 'tcp',
                                  '-addr', self._gocode_host,
                                  'close' ] )
          utils.WaitUntilProcessIsTerminated( self._gocode_handle, timeout = 5 )
          _logger.info( 'Gocode server stopped' )
        except Exception:
          _logger.exception( 'Error while stopping Gocode server' )

      self._CleanUp()
コード例 #7
0
    def Shutdown(self):
        with self._server_state_mutex:
            LOGGER.info('Shutting down %s...', self.GetServerName())

            # Tell the connection to expect the server to disconnect
            if self._connection:
                self._connection.Stop()

            if not self.ServerIsHealthy():
                LOGGER.info('%s is not running', self.GetServerName())
                self._Reset()
                return

            LOGGER.info('Stopping %s with PID %s', self.GetServerName(),
                        self._server_handle.pid)

            try:
                self.ShutdownServer()

                # By this point, the server should have shut down and terminated. To
                # ensure that isn't blocked, we close all of our connections and wait
                # for the process to exit.
                #
                # If, after a small delay, the server has not shut down we do NOT kill
                # it; we expect that it will shut itself down eventually. This is
                # predominantly due to strange process behaviour on Windows.
                if self._connection:
                    self._connection.Close()

                utils.WaitUntilProcessIsTerminated(self._server_handle,
                                                   timeout=15)

                LOGGER.info('%s stopped', self.GetServerName())
            except Exception:
                LOGGER.exception('Error while stopping %s',
                                 self.GetServerName())
                # We leave the process running. Hopefully it will eventually die of its
                # own accord.

            # Tidy up our internal state, even if the completer server didn't close
            # down cleanly.
            self._Reset()