From bdac8ed43e976438ed7222c405637def9bc1be08 Mon Sep 17 00:00:00 2001 From: micbou Date: Thu, 17 Aug 2017 19:43:19 +0200 Subject: [PATCH] Do not read server stderr Reading ycmd stderr blocks Vim if a subserver process is still up even if ycmd is not running. --- python/ycm/tests/youcompleteme_test.py | 12 +----------- python/ycm/youcompleteme.py | 5 ----- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/python/ycm/tests/youcompleteme_test.py b/python/ycm/tests/youcompleteme_test.py index dcc2d100..5ef7d7ee 100644 --- a/python/ycm/tests/youcompleteme_test.py +++ b/python/ycm/tests/youcompleteme_test.py @@ -50,7 +50,6 @@ def RunNotifyUserIfServerCrashed( ycm, test, post_vim_message ): ycm._logger = MagicMock( autospec = True ) ycm._server_popen = MagicMock( autospec = True ) ycm._server_popen.poll.return_value = test[ 'return_code' ] - ycm._server_popen.stderr.read.return_value = test[ 'stderr_output' ] ycm._NotifyUserIfServerCrashed() @@ -69,7 +68,6 @@ def YouCompleteMe_NotifyUserIfServerCrashed_UnexpectedCore_test(): "Use the ':YcmToggleLogs' command to check the logs." ) RunNotifyUserIfServerCrashed( { 'return_code': 3, - 'stderr_output' : '', 'expected_logs': [ message ], 'expected_vim_message': message } ) @@ -81,7 +79,6 @@ def YouCompleteMe_NotifyUserIfServerCrashed_MissingCore_test(): "using it. Follow the instructions in the documentation." ) RunNotifyUserIfServerCrashed( { 'return_code': 4, - 'stderr_output': '', 'expected_logs': [ message ], 'expected_vim_message': message } ) @@ -94,7 +91,6 @@ def YouCompleteMe_NotifyUserIfServerCrashed_Python2Core_test(): "interpreter path." ) RunNotifyUserIfServerCrashed( { 'return_code': 5, - 'stderr_output': '', 'expected_logs': [ message ], 'expected_vim_message': message } ) @@ -107,7 +103,6 @@ def YouCompleteMe_NotifyUserIfServerCrashed_Python3Core_test(): "interpreter path." ) RunNotifyUserIfServerCrashed( { 'return_code': 6, - 'stderr_output': '', 'expected_logs': [ message ], 'expected_vim_message': message } ) @@ -119,7 +114,6 @@ def YouCompleteMe_NotifyUserIfServerCrashed_OutdatedCore_test(): "install.py script. See the documentation for more details." ) RunNotifyUserIfServerCrashed( { 'return_code': 7, - 'stderr_output': '', 'expected_logs': [ message ], 'expected_vim_message': message } ) @@ -131,11 +125,7 @@ def YouCompleteMe_NotifyUserIfServerCrashed_UnexpectedExitCode_test(): "check the logs." ) RunNotifyUserIfServerCrashed( { 'return_code': 1, - 'stderr_output': 'First line\r\n' - 'Second line', - 'expected_logs': [ 'First line\n' - 'Second line', - message ], + 'expected_logs': [ message ], 'expected_vim_message': message } ) diff --git a/python/ycm/youcompleteme.py b/python/ycm/youcompleteme.py index cb7dcc5e..05369c9c 100644 --- a/python/ycm/youcompleteme.py +++ b/python/ycm/youcompleteme.py @@ -251,11 +251,6 @@ class YouCompleteMe( object ): else: 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 self._logger.error( error_message ) vimsupport.PostVimMessage( error_message )