Force ignoring of SIGINT for YCM client

This reduces fallout of pressing ctrl-c in Vim.
This commit is contained in:
Strahinja Val Markovic 2014-01-29 10:18:07 -08:00
parent 9f3a3e3019
commit 825b3055e5

View File

@ -21,6 +21,7 @@ import os
import vim import vim
import tempfile import tempfile
import json import json
import signal
from ycm import vimsupport from ycm import vimsupport
from ycm import utils from ycm import utils
from ycm.diagnostic_interface import DiagnosticInterface from ycm.diagnostic_interface import DiagnosticInterface
@ -51,6 +52,11 @@ except ImportError:
# https://github.com/kennethreitz/requests/issues/879 # https://github.com/kennethreitz/requests/issues/879
os.environ['no_proxy'] = '127.0.0.1,localhost' os.environ['no_proxy'] = '127.0.0.1,localhost'
# Force the Python interpreter embedded in Vim (in which we are running) to
# ignore the SIGINT signal. This helps reduce the fallout of a user pressing
# Ctrl-C in Vim.
signal.signal( signal.SIGINT, signal.SIG_IGN )
NUM_YCMD_STDERR_LINES_ON_CRASH = 30 NUM_YCMD_STDERR_LINES_ON_CRASH = 30
SERVER_CRASH_MESSAGE_STDERR_FILE = ( SERVER_CRASH_MESSAGE_STDERR_FILE = (
'The ycmd server SHUT DOWN (restart with :YcmRestartServer). ' + 'The ycmd server SHUT DOWN (restart with :YcmRestartServer). ' +