mirror of
https://github.com/Zandercraft/Aurora-lang.git
synced 2026-10-31 04:59:20 +00:00
Handle keyboard interrupts.
This commit is contained in:
16
main.py
16
main.py
@@ -25,13 +25,17 @@ def interactive_shell():
|
|||||||
print(WELCOME)
|
print(WELCOME)
|
||||||
|
|
||||||
# Start the programming loop.
|
# Start the programming loop.
|
||||||
while (u := input(f"{AURORA_TEXT}> ")) != "exit":
|
try:
|
||||||
result, error = aurora.evaluate('<stdin>', u)
|
while (u := input(f"{AURORA_TEXT}> ")) != "exit":
|
||||||
|
result, error = aurora.evaluate('<stdin>', u)
|
||||||
|
|
||||||
if error:
|
if error:
|
||||||
print(error.as_string())
|
print(error.as_string())
|
||||||
else:
|
else:
|
||||||
print(result)
|
print(result)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
# Handle keyboard interrupts and gracefully shut down.
|
||||||
|
print("^C") # bump exit message onto newline.
|
||||||
|
|
||||||
print(f"Thanks for using {AURORA_TEXT}! See you soon!")
|
print(f"Thanks for using {AURORA_TEXT}! See you soon!")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user