From: Mark Wooding Date: Mon, 13 Apr 2020 11:29:22 +0000 (+0100) Subject: mdwsetup.py: Turn off Python's usual `SIGINT' handler. X-Git-Tag: 1.4.0~1 X-Git-Url: https://git.distorted.org.uk/~mdw/cfd/commitdiff_plain/e638c0a3b3417bd5a2fb32cf4f61c6a42dab051f mdwsetup.py: Turn off Python's usual `SIGINT' handler. Without this, a buggy native-code extension can loop forever, and Emacs can't easily be persuaded to kill it. --- diff --git a/mdwsetup.py b/mdwsetup.py index 55120fb..876297e 100644 --- a/mdwsetup.py +++ b/mdwsetup.py @@ -28,12 +28,22 @@ from __future__ import with_statement import sys as SYS import os as OS import re as RE +import signal as SIG import subprocess as SUB import distutils.core as DC import distutils.log as DL ###-------------------------------------------------------------------------- +### Preliminaries. + +## Turn off Python's `SIGINT' handler. If we get stuck in a native-code loop +## then ^C will just set a flag that will be noticed by the main interpreter +## loop if we ever get to it again. And raising `SIGINT' is how Emacs `C-c +## C-k' aborts a compilation, so this is really unsatisfactory. +SIG.signal(SIG.SIGINT, SIG.SIG_DFL) + +###-------------------------------------------------------------------------- ### Compatibility hacks. def with_metaclass(meta, *supers):