Skip to content

Commit 315fbfc

Browse files
committed
allow user to cancel via ctrl+C
1 parent f180ce6 commit 315fbfc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/cli/eest/make/commands/test.py

+13
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"""
88

99
import os
10+
import signal
1011
import sys
1112
from pathlib import Path
1213

@@ -23,6 +24,12 @@
2324
)
2425

2526

27+
def exit_now():
28+
"""Helper function to allow user to interrupt execution instantly via ctrl+C."""
29+
print("Ctrl+C detected, exiting..")
30+
exit(0)
31+
32+
2633
@click.command(
2734
short_help="Generate a new test file for an EIP.",
2835
epilog=f"Further help: {DocsConfig().DOCS_URL__WRITING_TESTS}",
@@ -53,9 +60,13 @@ def test():
5360
test_type = input_select(
5461
"Choose the type of test to generate", choices=["State", "Blockchain"]
5562
)
63+
if test_type is None:
64+
exit_now()
5665

5766
fork_choices = [str(fork) for fork in get_forks()]
5867
fork = input_select("Select the fork", choices=fork_choices)
68+
if fork is None:
69+
exit_now()
5970

6071
base_path = Path("tests") / fork.lower()
6172
base_path.mkdir(parents=True, exist_ok=True)
@@ -70,6 +81,8 @@ def test():
7081
{"name": "** Create new sub-directory **", "value": "new"},
7182
],
7283
)
84+
if location_choice is None:
85+
exit_now()
7386

7487
if location_choice == "new":
7588
eip_number = input_text("Enter the EIP number (int)").strip()

0 commit comments

Comments
 (0)