mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-03 11:14:59 +00:00
refactor: handle UnicodeEncodeError by recreating InputOutput object
This commit is contained in:
parent
cc053b0b04
commit
1e8f2cbbb9
1 changed files with 20 additions and 20 deletions
|
@ -384,8 +384,9 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
|
|
||||||
editing_mode = EditingMode.VI if args.vim else EditingMode.EMACS
|
editing_mode = EditingMode.VI if args.vim else EditingMode.EMACS
|
||||||
|
|
||||||
io = InputOutput(
|
def get_io(pretty):
|
||||||
args.pretty,
|
return InputOutput(
|
||||||
|
pretty,
|
||||||
args.yes,
|
args.yes,
|
||||||
args.input_history_file,
|
args.input_history_file,
|
||||||
args.chat_history_file,
|
args.chat_history_file,
|
||||||
|
@ -400,15 +401,14 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
editingmode=editing_mode,
|
editingmode=editing_mode,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
io = get_io(args.pretty)
|
||||||
try:
|
try:
|
||||||
io.tool_output()
|
|
||||||
io.rule()
|
io.rule()
|
||||||
except UnicodeEncodeError as err:
|
except UnicodeEncodeError as err:
|
||||||
if io.pretty:
|
if not io.pretty:
|
||||||
io.pretty = False
|
|
||||||
io.tool_warning("Terminal does not support pretty output (UnicodeDecodeError)")
|
|
||||||
else:
|
|
||||||
raise err
|
raise err
|
||||||
|
io = get_io(False)
|
||||||
|
io.tool_warning("Terminal does not support pretty output (UnicodeDecodeError)")
|
||||||
|
|
||||||
if args.gui and not return_coder:
|
if args.gui and not return_coder:
|
||||||
if not check_streamlit_install(io):
|
if not check_streamlit_install(io):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue