Auto merge of #1875 - micbou:server-crash-message, r=puremourning
[READY] Update notifications when ycmd server crashed Instead of printing the last 30 lines of the `stderr` logfile if the server crashed, we tell the user to run the `:YcmToggleLogs stderr` command to check the logs. Remove `SERVER_CRASH_MESSAGE_SAME_STDERR` message because we are always using the `stderr` logfile since PR #1753. Also, console ouput cannot be used to see the logs. Simplify `_NotifyUserIfServerCrashed` method by using `CheckFilename` function from `vimsupport` module. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1875) <!-- Reviewable:end -->
This commit is contained in:
commit
f8b3d6643c
@ -69,17 +69,13 @@ PatchNoProxy()
|
|||||||
signal.signal( signal.SIGINT, signal.SIG_IGN )
|
signal.signal( signal.SIGINT, signal.SIG_IGN )
|
||||||
|
|
||||||
HMAC_SECRET_LENGTH = 16
|
HMAC_SECRET_LENGTH = 16
|
||||||
NUM_YCMD_STDERR_LINES_ON_CRASH = 30
|
|
||||||
SERVER_CRASH_MESSAGE_STDERR_FILE_DELETED = (
|
|
||||||
'The ycmd server SHUT DOWN (restart with :YcmRestartServer). '
|
|
||||||
'Logfile was deleted; set g:ycm_server_keep_logfiles to see errors '
|
|
||||||
'in the future.' )
|
|
||||||
SERVER_CRASH_MESSAGE_STDERR_FILE = (
|
SERVER_CRASH_MESSAGE_STDERR_FILE = (
|
||||||
'The ycmd server SHUT DOWN (restart with :YcmRestartServer). ' +
|
"The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). "
|
||||||
'Stderr (last {0} lines):\n\n'.format( NUM_YCMD_STDERR_LINES_ON_CRASH ) )
|
"Run ':YcmToggleLogs stderr' to check the logs." )
|
||||||
SERVER_CRASH_MESSAGE_SAME_STDERR = (
|
SERVER_CRASH_MESSAGE_STDERR_FILE_DELETED = (
|
||||||
'The ycmd server SHUT DOWN (restart with :YcmRestartServer). '
|
"The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). "
|
||||||
' check console output for logs!' )
|
"Logfile was deleted; set 'g:ycm_server_keep_logfiles' to see errors "
|
||||||
|
"in the future." )
|
||||||
SERVER_IDLE_SUICIDE_SECONDS = 10800 # 3 hours
|
SERVER_IDLE_SUICIDE_SECONDS = 10800 # 3 hours
|
||||||
|
|
||||||
|
|
||||||
@ -151,17 +147,11 @@ class YouCompleteMe( object ):
|
|||||||
if self._user_notified_about_crash or self.IsServerAlive():
|
if self._user_notified_about_crash or self.IsServerAlive():
|
||||||
return
|
return
|
||||||
self._user_notified_about_crash = True
|
self._user_notified_about_crash = True
|
||||||
if self._server_stderr:
|
|
||||||
try:
|
try:
|
||||||
with open( self._server_stderr, 'r' ) as server_stderr_file:
|
vimsupport.CheckFilename( self._server_stderr )
|
||||||
error_output = ''.join( server_stderr_file.readlines()[
|
vimsupport.PostVimMessage( SERVER_CRASH_MESSAGE_STDERR_FILE )
|
||||||
: - NUM_YCMD_STDERR_LINES_ON_CRASH ] )
|
except RuntimeError:
|
||||||
vimsupport.PostMultiLineNotice( SERVER_CRASH_MESSAGE_STDERR_FILE +
|
|
||||||
error_output )
|
|
||||||
except IOError:
|
|
||||||
vimsupport.PostVimMessage( SERVER_CRASH_MESSAGE_STDERR_FILE_DELETED )
|
vimsupport.PostVimMessage( SERVER_CRASH_MESSAGE_STDERR_FILE_DELETED )
|
||||||
else:
|
|
||||||
vimsupport.PostVimMessage( SERVER_CRASH_MESSAGE_SAME_STDERR )
|
|
||||||
|
|
||||||
|
|
||||||
def ServerPid( self ):
|
def ServerPid( self ):
|
||||||
|
Loading…
Reference in New Issue
Block a user