Auto merge of #2788 - micbou:options-file, r=bstaletic
[READY] Close options file before starting server See PR https://github.com/Valloric/ycmd/pull/841. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2788) <!-- Reviewable:end -->
This commit is contained in:
commit
32f1eae9cb
@ -138,17 +138,18 @@ class YouCompleteMe( object ):
|
|||||||
self._filetypes_with_keywords_loaded = set()
|
self._filetypes_with_keywords_loaded = set()
|
||||||
self._server_is_ready_with_cache = False
|
self._server_is_ready_with_cache = False
|
||||||
|
|
||||||
server_port = utils.GetUnusedLocalhostPort()
|
|
||||||
# The temp options file is deleted by ycmd during startup
|
|
||||||
with NamedTemporaryFile( delete = False, mode = 'w+' ) as options_file:
|
|
||||||
hmac_secret = os.urandom( HMAC_SECRET_LENGTH )
|
hmac_secret = os.urandom( HMAC_SECRET_LENGTH )
|
||||||
options_dict = dict( self._user_options )
|
options_dict = dict( self._user_options )
|
||||||
options_dict[ 'hmac_secret' ] = utils.ToUnicode(
|
options_dict[ 'hmac_secret' ] = utils.ToUnicode(
|
||||||
base64.b64encode( hmac_secret ) )
|
base64.b64encode( hmac_secret ) )
|
||||||
options_dict[ 'server_keep_logfiles' ] = self._user_options[
|
options_dict[ 'server_keep_logfiles' ] = self._user_options[
|
||||||
'keep_logfiles' ]
|
'keep_logfiles' ]
|
||||||
|
|
||||||
|
# The temp options file is deleted by ycmd during startup.
|
||||||
|
with NamedTemporaryFile( delete = False, mode = 'w+' ) as options_file:
|
||||||
json.dump( options_dict, options_file )
|
json.dump( options_dict, options_file )
|
||||||
options_file.flush()
|
|
||||||
|
server_port = utils.GetUnusedLocalhostPort()
|
||||||
|
|
||||||
BaseRequest.server_location = 'http://127.0.0.1:' + str( server_port )
|
BaseRequest.server_location = 'http://127.0.0.1:' + str( server_port )
|
||||||
BaseRequest.hmac_secret = hmac_secret
|
BaseRequest.hmac_secret = hmac_secret
|
||||||
|
Loading…
x
Reference in New Issue
Block a user