Skip to content

Commit

Permalink
Merge pull request OpenInterpreter#1456 from erhhung/main
Browse files Browse the repository at this point in the history
Fixes OpenInterpreter#925: Exiting by Ctrl-D throws EOFError
  • Loading branch information
KillianLucas authored Sep 26, 2024
2 parents bc3ea85 + 7976974 commit 547b180
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions interpreter/terminal_interface/terminal_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,16 @@ def terminal_interface(interpreter, message):
interpreter.messages = interpreter.messages[:-1]
else:
### This is the primary input for Open Interpreter.
message = (
cli_input("> ").strip()
if interpreter.multi_line
else input("> ").strip()
)
try:
message = (
cli_input("> ").strip()
if interpreter.multi_line
else input("> ").strip()
)
except (KeyboardInterrupt, EOFError):
# Treat Ctrl-D on an empty line the same as Ctrl-C by exiting gracefully
interpreter.display_message("\n\n`Exiting...`")
raise KeyboardInterrupt

try:
# This lets users hit the up arrow key for past messages
Expand Down

0 comments on commit 547b180

Please sign in to comment.