fix: handle file watcher operations only when it exists

This commit is contained in:
Paul Gauthier 2024-12-01 09:40:19 -08:00 committed by Paul Gauthier (aider)
parent 41e6fb961b
commit a04b9ea053

View file

@ -455,7 +455,7 @@ class InputOutput:
self.placeholder = None
self.interrupted = False
if not multiline_input:
if not multiline_input and self.file_watcher:
self.file_watcher.start()
line = self.prompt_session.prompt(
@ -478,12 +478,15 @@ class InputOutput:
except EOFError:
return ""
except Exception as err:
dump(err)
self.tool_error(str(err))
# print the traceback ai!
return ""
except UnicodeEncodeError as err:
self.tool_error(str(err))
return ""
finally:
self.file_watcher.stop()
if self.file_watcher:
self.file_watcher.stop()
if line.strip("\r\n") and not multiline_input:
stripped = line.strip("\r\n")