From 38d5bdfbc4691eaeada73708ffe372c4809c70e8 Mon Sep 17 00:00:00 2001 From: Qusic Date: Mon, 16 May 2016 21:12:00 +0800 Subject: [PATCH] check ycmd exit code https://github.com/Valloric/ycmd/pull/467 --- lib/handler.coffee | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/handler.coffee b/lib/handler.coffee index 442d896..4030060 100644 --- a/lib/handler.coffee +++ b/lib/handler.coffee @@ -66,10 +66,17 @@ launch = -> '--idle_suicide_seconds=600' ] options: {} - exit: (status) -> ycmdProcess = null - setTimeout(fulfill, 1000) stdout: (output) -> utility.debugLog 'CONSOLE', output stderr: (output) -> utility.debugLog 'CONSOLE', output + exit: (code) -> + ycmdProcess = null + switch code + when 3 then reject new Error 'Unexpected error while loading the YCM core library.' + when 4 then reject new Error 'YCM core library not detected; you need to compile YCM before using it. Follow the instructions in the documentation.' + when 5 then reject new Error 'YCM core library compiled for Python 3 but loaded in Python 2. Set the Python Executable config to a Python 3 interpreter path.' + when 6 then reject new Error 'YCM core library compiled for Python 2 but loaded in Python 3. Set the Python Executable config to a Python 2 interpreter path.' + when 7 then reject new Error 'YCM core library too old; PLEASE RECOMPILE by running the install.py script. See the documentation for more details.' + setTimeout fulfill, 1000 Promise.all [findUnusedPort, generateRandomSecret, readDefaultOptions] .then processData