From 825b3055e505e0a8d5c4484949522b39ddd8467c Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Wed, 29 Jan 2014 10:18:07 -0800 Subject: [PATCH] Force ignoring of SIGINT for YCM client This reduces fallout of pressing ctrl-c in Vim. --- python/ycm/youcompleteme.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/ycm/youcompleteme.py b/python/ycm/youcompleteme.py index c89dcceb..64de96d8 100644 --- a/python/ycm/youcompleteme.py +++ b/python/ycm/youcompleteme.py @@ -21,6 +21,7 @@ import os import vim import tempfile import json +import signal from ycm import vimsupport from ycm import utils from ycm.diagnostic_interface import DiagnosticInterface @@ -51,6 +52,11 @@ except ImportError: # https://github.com/kennethreitz/requests/issues/879 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 SERVER_CRASH_MESSAGE_STDERR_FILE = ( 'The ycmd server SHUT DOWN (restart with :YcmRestartServer). ' +