forked from genewildish/Mainline
Add Ctrl+C quit handling to REPL
- Add _quit_requested flag to TerminalDisplay - Add request_quit() method to TerminalDisplay - Handle 'ctrl_c' key in REPL input loops in both pipeline_runner.py and main.py - When Ctrl+C is pressed, request_quit() is called which sets the flag - The main loop checks is_quit_requested() and raises KeyboardInterrupt
This commit is contained in:
@@ -550,7 +550,13 @@ def run_pipeline_mode_direct():
|
||||
keys = display.get_input_keys(timeout=0.0)
|
||||
|
||||
for key in keys:
|
||||
if key == "return":
|
||||
if key == "ctrl_c":
|
||||
# Request quit when Ctrl+C is pressed
|
||||
if hasattr(display, "request_quit"):
|
||||
display.request_quit()
|
||||
else:
|
||||
raise KeyboardInterrupt()
|
||||
elif key == "return":
|
||||
# Get command string before processing
|
||||
cmd_str = repl_effect.state.current_command
|
||||
if cmd_str:
|
||||
|
||||
@@ -986,7 +986,13 @@ def run_pipeline_mode(preset_name: str = "demo", graph_config: str | None = None
|
||||
keys = display.get_input_keys(timeout=0.0)
|
||||
|
||||
for key in keys:
|
||||
if key == "return":
|
||||
if key == "ctrl_c":
|
||||
# Request quit when Ctrl+C is pressed
|
||||
if hasattr(display, "request_quit"):
|
||||
display.request_quit()
|
||||
else:
|
||||
raise KeyboardInterrupt()
|
||||
elif key == "return":
|
||||
# Get command string before processing
|
||||
cmd_str = repl_effect.state.current_command
|
||||
if cmd_str:
|
||||
|
||||
Reference in New Issue
Block a user