More reliable ctrl-c
parent
b26d968884
commit
495c947441
|
@ -127,6 +127,7 @@ class Runner:
|
|||
|
||||
|
||||
skip_to_end = False
|
||||
try:
|
||||
while (
|
||||
(
|
||||
(self.reduction_limit is None) or
|
||||
|
@ -141,11 +142,8 @@ class Runner:
|
|||
):
|
||||
print(f" Reducing... {k:,}", end = "\r")
|
||||
|
||||
try:
|
||||
# Reduce
|
||||
red_type, node = lamb_engine.nodes.reduce(node)
|
||||
except KeyboardInterrupt:
|
||||
stop_reason = StopReason.INTERRUPT
|
||||
break
|
||||
|
||||
# If we can't reduce this expression anymore,
|
||||
# it's in beta-normal form.
|
||||
|
@ -175,6 +173,10 @@ class Runner:
|
|||
("class:warn", "Skipping to end."),
|
||||
]), style = lamb_engine.utils.style)
|
||||
|
||||
# Gracefully catch keyboard interrupts
|
||||
except KeyboardInterrupt:
|
||||
stop_reason = StopReason.INTERRUPT
|
||||
|
||||
# Print a space between step messages
|
||||
if self.step_reduction:
|
||||
print("")
|
||||
|
|
Reference in New Issue