From 2736f254d6a7646773c6ecc1cd909104307ed7e8 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Sun, 5 Jun 2016 21:23:50 -0700 Subject: [PATCH] Handle ^C --- minheader.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/minheader.py b/minheader.py index 0300b4f..ca2e158 100755 --- a/minheader.py +++ b/minheader.py @@ -36,6 +36,10 @@ class BaseTestFailed(Error): pass +class Interrupted(Error): + pass + + class MinHeader(object): _INCLUDE_RE = re.compile('^#include ["<](?P[^>"]+\.[^>"]+)[>"]') @@ -133,7 +137,10 @@ class MinHeader(object): raise IncludeNotFound(path) def _TestPasses(self): - return subprocess.call(self._test_command, shell=True) == 0 + ret = subprocess.call(self._test_command, shell=True) + if ret in (-2, 8): + raise Interrupted + return ret == 0 def main():