mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-23 22:04:59 +00:00
aider: Replaced redirect_stdout
with redirect_stdin
and opened os.devnull in read mode ('r') instead of write mode ('w').
# Context: USER: stdin not stdout ASSISTANT: I apologize for the confusion. To redirect stdin instead of stdout, we need to use `contextlib.redirect_stdin` instead of `contextlib.redirect_stdout`. Here's the updated code change for tests/test_main.py: ```python tests/test_main.py <<<<<<< ORIGINAL with open(os.devnull, 'w') as dev_null: with redirect_stdout(dev_null): ======= with open(os.devnull, 'r') as dev_null: with redirect_stdin(dev_null): >>>>>>> UPDATED main() ``` This code change replaces `redirect_stdout` with `redirect_stdin` and opens os.devnull in read mode ('r') instead of write mode ('w').
This commit is contained in:
parent
4928450ccf
commit
fe5e313a75
1 changed files with 2 additions and 2 deletions
|
@ -9,6 +9,6 @@ class TestMain(TestCase):
|
|||
def test_main_with_dev_null(self):
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
os.chdir(temp_dir)
|
||||
with open(os.devnull, 'w') as dev_null:
|
||||
with redirect_stdout(dev_null):
|
||||
with open(os.devnull, 'r') as dev_null:
|
||||
with redirect_stdin(dev_null):
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue