Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aioconsole causes stdout crash #1079

Closed
TheTechromancer opened this issue Feb 8, 2024 · 2 comments
Closed

aioconsole causes stdout crash #1079

TheTechromancer opened this issue Feb 8, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@TheTechromancer
Copy link
Collaborator

TheTechromancer commented Feb 8, 2024

Sometimes when pressing enter during a scan (especially when a lot of stuff is being printed to the console), aioconsole throws an error. After this point, stdout no longer works.

Traceback (most recent call last):
  File "/root/bbot/bbot/cli.py", line 329, in akeyboard_listen
    keyboard_input = await ainput()
                     ^^^^^^^^^^^^^^
  File "/root/.cache/pypoetry/virtualenvs/bbot-aKeTQkGo-py3.11/lib/python3.11/site-packages/aioconsole/stream.py", line 284, in ainput
    raise EOFError
EOFError
@TheTechromancer TheTechromancer added the bug Something isn't working label Feb 8, 2024
@TheTechromancer TheTechromancer self-assigned this Feb 8, 2024
@TheTechromancer TheTechromancer changed the title But in aioconsole Bug in aioconsole Feb 8, 2024
@TheTechromancer TheTechromancer changed the title Bug in aioconsole aioconsole causes stdout crash Feb 9, 2024
@TheTechromancer
Copy link
Collaborator Author

The crash in aioconsole happens because aioconsole.ainput() puts both stdin and stdout into non-blocking mode. When our logger tries to write to it, it fails and everything crashes spectacularly.

There is already an upstream issue for this, which reproduces the error using the following code:

import asyncio
from aioconsole import ainput


async def main():
    await ainput("ainput: ")
    input("input: ")

asyncio.run(main())

@TheTechromancer
Copy link
Collaborator Author

Fixed in #1051.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant