Skip to content

Commit c2cf2a2

Browse files
fix(cli/eest): allow user to cancel via ctrl+C in interactive test creator (#1548)
* allow user to cancel via ctrl+C * Update src/cli/eest/make/commands/test.py --------- Co-authored-by: Mario Vega <[email protected]>
1 parent 0c6f531 commit c2cf2a2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

+12
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
)
2424

2525

26+
def exit_now():
27+
"""Interrupt execution instantly via ctrl+C."""
28+
print("Ctrl+C detected, exiting..")
29+
exit(0)
30+
31+
2632
@click.command(
2733
short_help="Generate a new test file for an EIP.",
2834
epilog=f"Further help: {DocsConfig().DOCS_URL__WRITING_TESTS}",
@@ -53,9 +59,13 @@ def test():
5359
test_type = input_select(
5460
"Choose the type of test to generate", choices=["State", "Blockchain"]
5561
)
62+
if test_type is None:
63+
exit_now()
5664

5765
fork_choices = [str(fork) for fork in get_forks()]
5866
fork = input_select("Select the fork", choices=fork_choices)
67+
if fork is None:
68+
exit_now()
5969

6070
base_path = Path("tests") / fork.lower()
6171
base_path.mkdir(parents=True, exist_ok=True)
@@ -70,6 +80,8 @@ def test():
7080
{"name": "** Create new sub-directory **", "value": "new"},
7181
],
7282
)
83+
if location_choice is None:
84+
exit_now()
7385

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

0 commit comments

Comments
 (0)