Skip to content

Commit 8599295

Browse files
committed
Add abort message
1 parent 629e4ce commit 8599295

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

mypy/__main__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55

66
from mypy.main import main
7+
from mypy.util import FancyFormatter
78

89

910
def console_entry() -> None:
@@ -18,6 +19,11 @@ def console_entry() -> None:
1819
os.dup2(devnull, sys.stdout.fileno())
1920
sys.exit(2)
2021
except KeyboardInterrupt:
22+
formatter = FancyFormatter(sys.stdout, sys.stderr, False)
23+
msg = " KeybordInterrupt called by user. Abort!\n"
24+
sys.stdout.write(formatter.style(msg, color="red", bold=True))
25+
sys.stdout.flush()
26+
sys.stderr.flush()
2127
sys.exit(2)
2228

2329

0 commit comments

Comments
 (0)