Do not read server stderr

Reading ycmd stderr blocks Vim if a subserver process is still up even if ycmd
is not running.
This commit is contained in:
micbou 2017-08-17 19:43:19 +02:00
parent 369fdade93
commit bdac8ed43e
No known key found for this signature in database
GPG Key ID: C7E8FD1F3BDA1E05
2 changed files with 1 additions and 16 deletions

View File

@ -50,7 +50,6 @@ def RunNotifyUserIfServerCrashed( ycm, test, post_vim_message ):
ycm._logger = MagicMock( autospec = True ) ycm._logger = MagicMock( autospec = True )
ycm._server_popen = MagicMock( autospec = True ) ycm._server_popen = MagicMock( autospec = True )
ycm._server_popen.poll.return_value = test[ 'return_code' ] ycm._server_popen.poll.return_value = test[ 'return_code' ]
ycm._server_popen.stderr.read.return_value = test[ 'stderr_output' ]
ycm._NotifyUserIfServerCrashed() ycm._NotifyUserIfServerCrashed()
@ -69,7 +68,6 @@ def YouCompleteMe_NotifyUserIfServerCrashed_UnexpectedCore_test():
"Use the ':YcmToggleLogs' command to check the logs." ) "Use the ':YcmToggleLogs' command to check the logs." )
RunNotifyUserIfServerCrashed( { RunNotifyUserIfServerCrashed( {
'return_code': 3, 'return_code': 3,
'stderr_output' : '',
'expected_logs': [ message ], 'expected_logs': [ message ],
'expected_vim_message': message 'expected_vim_message': message
} ) } )
@ -81,7 +79,6 @@ def YouCompleteMe_NotifyUserIfServerCrashed_MissingCore_test():
"using it. Follow the instructions in the documentation." ) "using it. Follow the instructions in the documentation." )
RunNotifyUserIfServerCrashed( { RunNotifyUserIfServerCrashed( {
'return_code': 4, 'return_code': 4,
'stderr_output': '',
'expected_logs': [ message ], 'expected_logs': [ message ],
'expected_vim_message': message 'expected_vim_message': message
} ) } )
@ -94,7 +91,6 @@ def YouCompleteMe_NotifyUserIfServerCrashed_Python2Core_test():
"interpreter path." ) "interpreter path." )
RunNotifyUserIfServerCrashed( { RunNotifyUserIfServerCrashed( {
'return_code': 5, 'return_code': 5,
'stderr_output': '',
'expected_logs': [ message ], 'expected_logs': [ message ],
'expected_vim_message': message 'expected_vim_message': message
} ) } )
@ -107,7 +103,6 @@ def YouCompleteMe_NotifyUserIfServerCrashed_Python3Core_test():
"interpreter path." ) "interpreter path." )
RunNotifyUserIfServerCrashed( { RunNotifyUserIfServerCrashed( {
'return_code': 6, 'return_code': 6,
'stderr_output': '',
'expected_logs': [ message ], 'expected_logs': [ message ],
'expected_vim_message': message 'expected_vim_message': message
} ) } )
@ -119,7 +114,6 @@ def YouCompleteMe_NotifyUserIfServerCrashed_OutdatedCore_test():
"install.py script. See the documentation for more details." ) "install.py script. See the documentation for more details." )
RunNotifyUserIfServerCrashed( { RunNotifyUserIfServerCrashed( {
'return_code': 7, 'return_code': 7,
'stderr_output': '',
'expected_logs': [ message ], 'expected_logs': [ message ],
'expected_vim_message': message 'expected_vim_message': message
} ) } )
@ -131,11 +125,7 @@ def YouCompleteMe_NotifyUserIfServerCrashed_UnexpectedExitCode_test():
"check the logs." ) "check the logs." )
RunNotifyUserIfServerCrashed( { RunNotifyUserIfServerCrashed( {
'return_code': 1, 'return_code': 1,
'stderr_output': 'First line\r\n' 'expected_logs': [ message ],
'Second line',
'expected_logs': [ 'First line\n'
'Second line',
message ],
'expected_vim_message': message 'expected_vim_message': message
} ) } )

View File

@ -251,11 +251,6 @@ class YouCompleteMe( object ):
else: else:
error_message = EXIT_CODE_UNEXPECTED_MESSAGE.format( code = return_code ) error_message = EXIT_CODE_UNEXPECTED_MESSAGE.format( code = return_code )
server_stderr = '\n'.join(
utils.ToUnicode( self._server_popen.stderr.read() ).splitlines() )
if server_stderr:
self._logger.error( server_stderr )
error_message = SERVER_SHUTDOWN_MESSAGE + ' ' + error_message error_message = SERVER_SHUTDOWN_MESSAGE + ' ' + error_message
self._logger.error( error_message ) self._logger.error( error_message )
vimsupport.PostVimMessage( error_message ) vimsupport.PostVimMessage( error_message )