From 62949c42ed482ca5dd59912ca4c010b8ba02a6f7 Mon Sep 17 00:00:00 2001 From: rxwen Date: Tue, 14 Jan 2014 22:05:03 +0800 Subject: [PATCH 1/2] flush the options_file before start the ycmd server - There are cases on windows that the ycmd will read an empty options file. So, flush the options file before start the ycmd server --- python/ycm/youcompleteme.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/ycm/youcompleteme.py b/python/ycm/youcompleteme.py index 8212f023..c89dcceb 100644 --- a/python/ycm/youcompleteme.py +++ b/python/ycm/youcompleteme.py @@ -84,6 +84,7 @@ class YouCompleteMe( object ): with tempfile.NamedTemporaryFile( delete = False ) as options_file: self._temp_options_filename = options_file.name json.dump( dict( self._user_options ), options_file ) + options_file.flush() args = [ utils.PathToPythonInterpreter(), _PathToServerScript(), '--port={0}'.format( server_port ), From 5fc4a00b7c5c5be0facc0040b52a54fc072f7158 Mon Sep 17 00:00:00 2001 From: rxwen Date: Tue, 14 Jan 2014 23:22:48 +0800 Subject: [PATCH 2/2] There is no way for a dictionary to return None for non-existing key if a default value is provided --- python/ycm/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ycm/utils.py b/python/ycm/utils.py index fcd81a6c..608b484f 100644 --- a/python/ycm/utils.py +++ b/python/ycm/utils.py @@ -176,7 +176,7 @@ def ForceSemanticCompletion( request_data ): # A wrapper for subprocess.Popen that works around a Popen bug on Windows. def SafePopen( *args, **kwargs ): - if kwargs.get( 'stdin', '' ) is None: + if kwargs.get( 'stdin' ) is None: # We need this on Windows otherwise bad things happen. See issue #637. kwargs[ 'stdin' ] = subprocess.PIPE if OnWindows() else None