From 269d456a797d3fc7dbd22bb6405581f5f61c1e82 Mon Sep 17 00:00:00 2001 From: Vysakh Sreenivasan Date: Sun, 11 Aug 2024 23:58:03 +0530 Subject: [PATCH] fix inputhandler overlap properly --- src/drd/cli/monitor/error_resolver.py | 6 ------ src/drd/cli/monitor/input_handler.py | 12 ++++++++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/drd/cli/monitor/error_resolver.py b/src/drd/cli/monitor/error_resolver.py index 950f7d7..ae86963 100644 --- a/src/drd/cli/monitor/error_resolver.py +++ b/src/drd/cli/monitor/error_resolver.py @@ -18,9 +18,6 @@ def monitoring_handle_error_with_dravid(error, error_trace, monitor): # error_type = type(error).__name__ # error_trace = ''.join(traceback.format_exception( # type(error), error, error.__traceback__)) - print("the type is *******") - print(error) - print("++++000-----") project_context = monitor.metadata_manager.get_project_context() print_info("Identifying relevant files for error context...") @@ -28,9 +25,6 @@ def monitoring_handle_error_with_dravid(error, error_trace, monitor): There is an error in the project. Identify ony the files related to it error_trace: {error} """ - input("testing >") - input("testing1 >") - return True files_to_check = run_with_loader( lambda: get_files_to_modify(error_details, project_context), diff --git a/src/drd/cli/monitor/input_handler.py b/src/drd/cli/monitor/input_handler.py index aa0498d..528ac90 100644 --- a/src/drd/cli/monitor/input_handler.py +++ b/src/drd/cli/monitor/input_handler.py @@ -1,4 +1,5 @@ import sys +import select import click import glob import os @@ -24,9 +25,16 @@ def handle_input(self): self.logger.info("InputHandler triggered to handle input") print_info("\nNo more tasks to auto-process. What can I do next?") self._show_options() - user_input = input("") + user_input = self._get_input() self.logger.info(f"Received user input: {user_input}") - self._process_input(user_input) + if user_input: + self._process_input(user_input) + + def _get_input(self): + while self.monitor.get_state() == ServerState.NORMAL: + if sys.stdin in select.select([sys.stdin], [], [], 0.1)[0]: + return input("> ") + return None def _show_options(self): print_info("\nAvailable actions:")